From e160151686dd9d337a1eb6150f28ad60d654105e Mon Sep 17 00:00:00 2001 From: Christophe Bourcier Date: Mon, 11 Sep 2023 11:39:00 +0200 Subject: [PATCH] Allow testme.py to be launched outside SHAPER (in RESTRICTED for instance) --- test.hdfs/testme.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test.hdfs/testme.py b/test.hdfs/testme.py index bdd7089f1..3a8965943 100644 --- a/test.hdfs/testme.py +++ b/test.hdfs/testme.py @@ -25,7 +25,6 @@ if __name__ == '__main__': from time import sleep import sys, os import tempfile - import psutil testTimeout = 600 if len(sys.argv) > 3: @@ -38,13 +37,19 @@ if __name__ == '__main__': tempfile = tempfile.NamedTemporaryFile() hdffile_basename = os.path.basename(hdffile) + test_hdfpy = "test_hdf.py" + if not os.path.exists(test_hdfpy): + # add absolute path in SHAPER install directory + test_hdfpy = os.path.join(os.getenv("SHAPER_ROOT_DIR"), "bin", "salome", "test", "HDFs", test_hdfpy) + if not os.path.exists(test_hdfpy): + raise Exception("test_hdf.py could not be found. Check your environment.") testlogfile = tempfile.name + "_" + hdffile_basename.replace(".", "_") tempfile.close() isOk = True error = "" - proc = subprocess.Popen(["runSalome.py", "--modules", "SHAPER,GEOM,SHAPERSTUDY", "--gui", "--splash", "0", "test_hdf.py", "args:" + hdffile + "," + testdatafile + "," + testlogfile]) + proc = subprocess.Popen(["runSalome.py", "--modules", "SHAPER,GEOM,SHAPERSTUDY", "--gui", "--splash", "0", test_hdfpy, "args:" + hdffile + "," + testdatafile + "," + testlogfile]) try: proc.communicate(timeout = testTimeout) except subprocess.TimeoutExpired: -- 2.39.2