From b6d93b95ff440662fd181ce0c017dfe8dbe59e71 Mon Sep 17 00:00:00 2001 From: Christophe Bourcier Date: Wed, 6 Jan 2021 10:24:27 +0100 Subject: [PATCH] MEDWriter tests write in tmp directory --- src/Plugins/MEDWriter/plugin/Test/TestMEDWriter0.py | 5 ++++- src/Plugins/MEDWriter/plugin/Test/TestMEDWriter1.py | 10 +++++----- 2 files changed, 9 insertions(+), 6 deletions(-) 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) -- 2.39.2