From: Christophe Bourcier Date: Wed, 6 Jan 2021 09:24:27 +0000 (+0100) Subject: MEDWriter tests write in tmp directory X-Git-Tag: V9_7_0a1~10 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fcbr%2Fimprove_medwriter_with_int64_fields;p=modules%2Fparavis.git MEDWriter tests write in tmp directory --- diff --git a/src/Plugins/MEDWriter/plugin/Test/TestMEDWriter0.py b/src/Plugins/MEDWriter/plugin/Test/TestMEDWriter0.py index 347c1e51..332097b8 100644 --- a/src/Plugins/MEDWriter/plugin/Test/TestMEDWriter0.py +++ b/src/Plugins/MEDWriter/plugin/Test/TestMEDWriter0.py @@ -23,11 +23,14 @@ from paraview.simple import * import MEDLoader as ml import os from math import pi,sqrt +import tempfile #### disable automatic camera reset on 'Show' paraview.simple._DisableFirstRenderCameraReset() -pat='testMEDWriter_%i.med' +tmpdir = tempfile.TemporaryDirectory(prefix="MEDWriter_") + +pat=os.path.join(tmpdir.name, 'testMEDWriter_%i.med') fname0=pat%0 fname1=pat%1 fname2=pat%2 diff --git a/src/Plugins/MEDWriter/plugin/Test/TestMEDWriter1.py b/src/Plugins/MEDWriter/plugin/Test/TestMEDWriter1.py index ab2e474c..31c61180 100644 --- a/src/Plugins/MEDWriter/plugin/Test/TestMEDWriter1.py +++ b/src/Plugins/MEDWriter/plugin/Test/TestMEDWriter1.py @@ -22,13 +22,15 @@ from paraview.simple import * import MEDLoader as ml import os from math import pi,sqrt +import tempfile #### disable automatic camera reset on 'Show' paraview.simple._DisableFirstRenderCameraReset() -#fname_int32='testMEDWriter_int32.med' -fname_int64 = 'testMEDWriter_int64.med' -fname_int64_exported = 'testMEDWriter_int64_exported.med' +tmpdir = tempfile.TemporaryDirectory(prefix="MEDWriter_") + +fname_int64 = os.path.join(tmpdir.name, 'testMEDWriter_int64.med') +fname_int64_exported = os.path.join(tmpdir.name, 'testMEDWriter_int64_exported.med') ### test with int array field @@ -84,8 +86,6 @@ f1ts12n.setFieldNoProfileSBT(f1n) f1ts12n.write(fname_int64,0) test12=MEDReader(FileName=fname_int64) -#test12.AllArrays=['TS0/%s/ComSup0/%s@@][@@P0'%(mName,fieldNameOnCells),'TS0/%s/ComSup0/%s@@][@@P1'%(mName,fieldNameOnNodes)] -#test12.AllTimeSteps = ['0000'] SaveData(fname_int64_exported, WriteAllTimeSteps=1) ### test content of fname_int64_exported mfd2=ml.MEDFileData(fname_int64_exported)