]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Allow testme.py to be launched outside SHAPER (in RESTRICTED for instance)
authorChristophe Bourcier <christophe.bourcier@cea.fr>
Mon, 11 Sep 2023 09:39:00 +0000 (11:39 +0200)
committerChristophe Bourcier <christophe.bourcier@cea.fr>
Mon, 11 Sep 2023 09:39:00 +0000 (11:39 +0200)
test.hdfs/testme.py

index bdd7089f18a27c6bb6cf75621a52fca662065651..3a89659438163b92c3d8f2a95a5b0ef19d1691a5 100644 (file)
@@ -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: