]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
[EDF19821] : 2 last vicious cases
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 19 Jul 2019 07:26:42 +0000 (09:26 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 19 Jul 2019 07:26:42 +0000 (09:26 +0200)
src/MEDCoupling_Swig/MEDCouplingExamplesTest.py
src/PyWrapping/TestPyWrapGathered_medcoupling.py

index 26499420cc05b4ccc5df82fe420bc3c48fd3c8c3..a13a0be189b98b85520cebc6ce7e59b910dc60a1 100644 (file)
@@ -27,8 +27,20 @@ else:
 import unittest
 from math import pi, sqrt
 
+def WriteInTmpDir(func):
+    def decoratedFunc(*args,**kwargs):
+        import tempfile,os
+        ret = None
+        with tempfile.TemporaryDirectory() as tmpdirname:
+            os.chdir(tmpdirname)
+            ret = func(*args,**kwargs)
+            pass
+        return ret
+    return decoratedFunc
+
 class MEDCouplingBasicsTest(unittest.TestCase):
 
+    @WriteInTmpDir
     def testExample_MEDCouplingFieldDouble_WriteVTK(self):
         #! [PySnippet_MEDCouplingFieldDouble_WriteVTK_1]
         # mesh
index 551df46891f235137a8d70255d887f998b5656a3..825601e334925c34db837f51f0cbfc26a93b0ec4 100644 (file)
 # Author : Anthony Geay (EDF R&D)
 
 from medcoupling import *
+
 import unittest
 
+def WriteInTmpDir(func):
+    def decoratedFunc(*args,**kwargs):
+        import tempfile,os
+        ret = None
+        with tempfile.TemporaryDirectory() as tmpdirname:
+            os.chdir(tmpdirname)
+            ret = func(*args,**kwargs)
+            pass
+        return ret
+    return decoratedFunc
+
 class FileCreator(object):
     def __init__(self,tester,fname):
         self._tester=tester
@@ -59,6 +71,7 @@ class medcouplingTest(unittest.TestCase):
         pass
     
     @unittest.skipUnless(HasMEDFileExt(),"Requires link to MED file")
+    @WriteInTmpDir
     def test1(self):
         import sys
         fname="mctest1.med"