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
# 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
pass
@unittest.skipUnless(HasMEDFileExt(),"Requires link to MED file")
+ @WriteInTmpDir
def test1(self):
import sys
fname="mctest1.med"