Python script for HOMARD
Test test_1
"""
-__revision__ = "V4.01"
+__revision__ = "V4.02"
#========================================================================
TEST_NAME = "test_1"
N_ITER_TEST_FILE = 3
#========================================================================
import os
-import tempfile
import sys
import HOMARD
import salome
REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
REP_PYTHON = os.path.normpath(REP_PYTHON)
sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
- DIRCASE = os.path.join("/tmp", TEST_NAME)
- if ( os.path.isdir(DIRCASE) ) :
- remove_dir(DIRCASE)
- os.mkdir(DIRCASE)
-else :
- DIRCASE = tempfile.mkdtemp(prefix=TEST_NAME)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE, DATA_TUTORIAL = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
# ==================================
salome.salome_init()
zones_1_et_2.AddZone('Zone_1_1', 1)
zones_1_et_2.AddZone('Zone_1_2', 1)
laux = zones_1_et_2.GetZones()
- nbzone = len(laux)/2
- jaux = 0
- for iaux in range(nbzone) :
- print(hyponame_2, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux])
- jaux += 2
+ nbzone = len(laux) // 2
+ iaux = 0
+ for _ in range(nbzone) :
+ print(hyponame_2, " : ", dico[laux[iaux+1]], "sur la zone", laux[iaux])
+ iaux += 2
print(hyponame_2, " : champ utilisé :", zones_1_et_2.GetFieldName())
if ( len (zones_1_et_2.GetFieldName()) > 0 ) :
print(".. caractéristiques de l'adaptation :", zones_1_et_2.GetField())
ERROR = homard_exec(salome.myStudy)
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
- raise Exception('Pb in homard_exec: '+eee.message)
+except RuntimeError as eee:
+ raise Exception('Pb in homard_exec: '+str(eee.message))
#
# Test of the results
#
Python script for HOMARD
Test test_2
"""
-__revision__ = "V4.01"
+__revision__ = "V4.02"
#========================================================================
TEST_NAME = "test_2"
N_ITER_TEST_FILE = 3
#========================================================================
import os
-import tempfile
import sys
import HOMARD
import salome
REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
REP_PYTHON = os.path.normpath(REP_PYTHON)
sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
- DIRCASE = os.path.join("/tmp", TEST_NAME)
- if ( os.path.isdir(DIRCASE) ) :
- remove_dir(DIRCASE)
- os.mkdir(DIRCASE)
-else :
- DIRCASE = tempfile.mkdtemp(prefix=TEST_NAME)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE, DATA_TUTORIAL = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
# ==================================
salome.salome_init()
ERROR = homard_exec(salome.myStudy)
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
- raise Exception('Pb in homard_exec: '+eee.message)
+except RuntimeError as eee:
+ raise Exception('Pb in homard_exec: '+str(eee.message))
#
# Test of the results
#
Python script for HOMARD
Test test_3
"""
-__revision__ = "V4.02"
+__revision__ = "V4.03"
#========================================================================
TEST_NAME = "test_3"
N_ITER_TEST_FILE = 2
#========================================================================
import os
-import tempfile
import sys
import HOMARD
import salome
REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
REP_PYTHON = os.path.normpath(REP_PYTHON)
sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
- DIRCASE = os.path.join("/tmp", TEST_NAME)
- if ( os.path.isdir(DIRCASE) ) :
- remove_dir(DIRCASE)
- os.mkdir(DIRCASE)
-else :
- DIRCASE = tempfile.mkdtemp(prefix=TEST_NAME)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE, DATA_TUTORIAL = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
# ==================================
salome.salome_init()
ERROR = homard_exec(salome.myStudy)
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
- raise Exception('Pb in homard_exec: '+eee.message)
+except RuntimeError as eee:
+ raise Exception('Pb in homard_exec: '+str(eee.message))
#
# Test of the results
#
Python script for HOMARD
Test test_4
"""
-__revision__ = "V3.01"
+__revision__ = "V3.02"
#========================================================================
TEST_NAME = "test_4"
DZ = 200.
#========================================================================
import os
-import tempfile
import sys
import numpy as np
import salome
REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
REP_PYTHON = os.path.normpath(REP_PYTHON)
sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
- DIRCASE = os.path.join("/tmp", TEST_NAME)
- if ( os.path.isdir(DIRCASE) ) :
- remove_dir(DIRCASE)
- os.mkdir(DIRCASE)
-else :
- DIRCASE = tempfile.mkdtemp(prefix=TEST_NAME)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE, DATA_TUTORIAL = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
# ==================================
salome.salome_init()
try:
ficmed = os.path.join(DIRCASE, 'maill.00.med')
box_m.ExportMED( ficmed, 0, SMESH.MED_V2_2, 1, None, 1)
- except Exception as eee:
+ except IOError as eee:
error = 2
- raise Exception('ExportToMEDX() failed. '+eee.message)
+ raise Exception('ExportToMEDX() failed. '+str(eee.message))
#
break
#
hypo_4_1.AddZone('Zone_4_1', 1)
hypo_4_1.SetExtraOutput(2)
laux = hypo_4_1.GetZones()
- nbzone = len(laux)/2
+ nbzone = len(laux) // 2
jaux = 0
- for iaux in range(nbzone) :
+ for _ in range(nbzone) :
print(hyponame_1, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux])
jaux += 2
# Creation of the hypothesis hypo_4_2
hypo_4_2.AddZone('Zone_4_2', 1)
hypo_4_2.SetExtraOutput(2)
laux = hypo_4_2.GetZones()
- nbzone = len(laux)/2
+ nbzone = len(laux) // 2
jaux = 0
- for iaux in range(nbzone) :
+ for _ in range(nbzone) :
print(hyponame_2, " : ", dico[laux[jaux+1]], "sur la zone", laux[jaux])
jaux += 2
# Creation of the hypothesis DISTANCE INVERSE
ERROR = geom_smesh_exec(salome.myStudy)
if ERROR :
raise Exception('Pb in geom_smesh_exec')
-except Exception as eee:
- raise Exception('Pb in geom_smesh_exec: '+eee.message)
+except RuntimeError as eee:
+ raise Exception('Pb in geom_smesh_exec: '+str(eee.message))
HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
assert HOMARD is not None, "Impossible to load homard engine"
ERROR = homard_exec(salome.myStudy)
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
- raise Exception('Pb in homard_exec: '+eee.message)
+except RuntimeError as eee:
+ raise Exception('Pb in homard_exec: '+str(eee.message))
#
# Test of the results
#
Specific conditions for Code_Saturne
Test test_5
"""
-__revision__ = "V2.01"
+__revision__ = "V2.02"
#========================================================================
TEST_NAME = "test_5"
MESH_NAME = "MESH"
#========================================================================
import os
-import tempfile
import sys
import numpy as np
import salome
REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
REP_PYTHON = os.path.normpath(REP_PYTHON)
sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
- DIRCASE = os.path.join("/tmp", TEST_NAME)
- if ( os.path.isdir(DIRCASE) ) :
- remove_dir(DIRCASE)
- os.mkdir(DIRCASE)
-else :
- DIRCASE = tempfile.mkdtemp(prefix=TEST_NAME)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE, DATA_TUTORIAL = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
# ==================================
salome.salome_init()
#
coordinates = list()
coo_z = -0.5*LG_Z
- for kaux in range(nbno_z) :
+ for _ in range(nbno_z) :
coo_y = -0.5*LG_Y
- for jaux in range(nbno_y) :
+ for _ in range(nbno_y) :
coo_x = -0.5*LG_X
- for iaux in range(nbno_x) :
+ for _ in range(nbno_x) :
coordinates.append(coo_x)
coordinates.append(coo_y)
coordinates.append(coo_z)
ficmed = os.path.join(DIRCASE, 'maill.00.med')
#print "Ecriture du maillage dans le fichier", ficmed
meshMEDFile3D.write(ficmed, 2)
- except Exception as eee:
+ except IOError as eee:
error = 2
- raise Exception('ExportToMEDX() failed. '+eee.message)
+ raise Exception('ExportToMEDX() failed. '+str(eee.message))
#
break
#
ERROR = mesh_exec(salome.myStudy)
if ERROR :
raise Exception('Pb in mesh_exec')
-except Exception as eee:
- raise Exception('Pb in mesh_exec: '+eee.message)
+except RuntimeError as eee:
+ raise Exception('Pb in mesh_exec: '+str(eee.message))
HOMARD = salome.lcc.FindOrLoadComponent('FactoryServer', 'HOMARD')
assert HOMARD is not None, "Impossible to load homard engine"
ERROR = homard_exec(salome.myStudy)
if ERROR :
raise Exception('Pb in homard_exec at iteration %d' %ERROR )
-except Exception as eee:
- raise Exception('Pb in homard_exec: '+eee.message)
+except RuntimeError as eee:
+ raise Exception('Pb in homard_exec: '+str(eee.message))
#
# Test of the results
#
Python script for HOMARD
Test test_6
"""
-__revision__ = "V1.02"
+__revision__ = "V1.03"
#========================================================================
TEST_NAME = "test_6"
LG_ARETE = TAILLE*2.5
#========================================================================
import os
-import tempfile
import sys
import HOMARD
import salome
REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
REP_PYTHON = os.path.normpath(REP_PYTHON)
sys.path.append(REP_PYTHON)
-from test_util import remove_dir
-from test_util import test_results
from test_util import saveGeometry
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
- DIRCASE = os.path.join("/tmp", TEST_NAME)
- if ( os.path.isdir(DIRCASE) ) :
- remove_dir(DIRCASE)
- os.mkdir(DIRCASE)
-else :
- DIRCASE = tempfile.mkdtemp(prefix=TEST_NAME)
+from test_util import get_dir
+from test_util import test_results
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE, DATA_TUTORIAL = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
salome.salome_init()
import iparameters
XAO_FILE = os.path.join(DIRCASE, TEST_NAME+".xao")
try :
ERREUR = saveGeometry(XAO_FILE, TEST_NAME, "test_salome_"+TEST_NAME)
- except Exception, eee:
- ERREUR = 2000
- MESSAGE = eee.message
+ except IOError as eee:
+ ERREUR = os.error
+ MESSAGE = str(eee.message)
#
if ERREUR :
MESSAGE += "Pb in saveGeometry"
#
try:
ERREUR, MESSAGE = homard_exec(TEST_NAME, FICMED, XAO_FILE, VERBOSE)
- except Exception, eee:
- ERREUR = 4000
- MESSAGE = eee.message
+ except RuntimeError as eee:
+ ERREUR = os.error
+ MESSAGE = str(eee.message)
#
if ERREUR :
MESSAGE += "Pb in homard_exec"
Python script for HOMARD
Utilitaires pour les tests
"""
-__revision__ = "V3.03"
+__revision__ = "V4.01"
import os
+import tempfile
import MEDLoader as ml
import shutil
#========================================================================
#========================================================================
+def get_dir(path_homard, test_name, debug=False) :
+ """
+Get directories for the test.
+Copyright EDF 2018
+ """
+#
+# Répertoire des données du test
+ rep_data = os.path.join(path_homard, "share", "salome", "homardsamples")
+ rep_data = os.path.normpath(rep_data)
+#
+# Répertoire des résultats
+ if debug :
+ dircase = os.path.join("/tmp", test_name)
+ if ( os.path.isdir(dircase) ) :
+ remove_dir(dircase)
+ os.mkdir(dircase)
+ else :
+ dircase = tempfile.mkdtemp(prefix=test_name)
+#
+# Répertoire des données du tutorial
+ data_tutorial = os.path.join(path_homard, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
+ data_tutorial = os.path.normpath(data_tutorial)
+#
+ return rep_data, dircase, data_tutorial
+#
+#========================================================================
+#========================================================================
def remove_dir(directory) :
"""
Empties, then removes a directory.
Python script for HOMARD
Test tutorial_1 associe au tutorial 1
"""
-__revision__ = "V4.02"
+__revision__ = "V4.03"
#========================================================================
TEST_NAME = "tutorial_1"
N_ITER_TEST_FILE = 3
#========================================================================
import os
-import tempfile
import sys
import HOMARD
import salome
REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
REP_PYTHON = os.path.normpath(REP_PYTHON)
sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
- DIRCASE = os.path.join("/tmp", TEST_NAME)
- if ( os.path.isdir(DIRCASE) ) :
- remove_dir(DIRCASE)
- os.mkdir(DIRCASE)
-else :
- DIRCASE = tempfile.mkdtemp(prefix=TEST_NAME)
-# Repertoire des donnees du tutorial
-DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
-DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE, DATA_TUTORIAL = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+# ==================================
sys.path.append(DATA_TUTORIAL)
from tutorial_util import gzip_gunzip
# ==================================
FICMED = os.path.join(DATA_TUTORIAL, TEST_NAME+".00.med")
try:
ERREUR, MESSAGE = homard_exec("MAILL", FICMED, DEBUG)
- except Exception, eee:
+ except RuntimeError as eee:
ERREUR = 2
- MESSAGE = eee.message
+ MESSAGE = str(eee.message)
#
if ERREUR :
MESSAGE += "Pb in homard_exec"
Python script for HOMARD
Test tutorial_2 associe au tutorial 2
"""
-__revision__ = "V4.02"
+__revision__ = "V4.03"
#========================================================================
TEST_NAME = "tutorial_2"
N_ITER_TEST_FILE = 2
#========================================================================
import os
-import tempfile
import sys
import HOMARD
import salome
REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
REP_PYTHON = os.path.normpath(REP_PYTHON)
sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
- DIRCASE = os.path.join("/tmp", TEST_NAME)
- if ( os.path.isdir(DIRCASE) ) :
- remove_dir(DIRCASE)
- os.mkdir(DIRCASE)
-else :
- DIRCASE = tempfile.mkdtemp(prefix=TEST_NAME)
-# Repertoire des donnees du tutorial
-DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
-DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE, DATA_TUTORIAL = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+# ==================================
sys.path.append(DATA_TUTORIAL)
from tutorial_util import gzip_gunzip
# ==================================
FICMED = os.path.join(DATA_TUTORIAL, TEST_NAME+".00.med")
try:
ERREUR, MESSAGE = homard_exec("MZERO", FICMED, DEBUG)
- except Exception, eee:
+ except RuntimeError as eee:
ERREUR = 2
- MESSAGE = eee.message
+ MESSAGE = str(eee.message)
#
if ERREUR :
MESSAGE += "Pb in homard_exec"
Python script for HOMARD
Test tutorial_3 associe au tutorial 3
"""
-__revision__ = "V4.02"
+__revision__ = "V4.03"
#========================================================================
TEST_NAME = "tutorial_3"
N_ITER_TEST_FILE = 2
#========================================================================
import os
-import tempfile
import sys
import HOMARD
import salome
REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
REP_PYTHON = os.path.normpath(REP_PYTHON)
sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
- DIRCASE = os.path.join("/tmp", TEST_NAME)
- if ( os.path.isdir(DIRCASE) ) :
- remove_dir(DIRCASE)
- os.mkdir(DIRCASE)
-else :
- DIRCASE = tempfile.mkdtemp(prefix=TEST_NAME)
-# Repertoire des donnees du tutorial
-DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
-DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE, DATA_TUTORIAL = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+# ==================================
sys.path.append(DATA_TUTORIAL)
from tutorial_util import gzip_gunzip
# ==================================
FICMED = os.path.join(DATA_TUTORIAL, TEST_NAME+".00.med")
try:
ERREUR, MESSAGE = homard_exec("G_0", FICMED, DEBUG)
- except Exception, eee:
+ except RuntimeError as eee:
ERREUR = 2
- MESSAGE = eee.message
+ MESSAGE = str(eee.message)
#
if ERREUR :
MESSAGE += "Pb in homard_exec"
Python script for HOMARD
Test tutorial_4 associe au tutorial 4
"""
-__revision__ = "V5.01"
+__revision__ = "V5.02"
#========================================================================
TEST_NAME = "tutorial_4"
N_ITER_TEST_FILE = 3
#========================================================================
import os
-import tempfile
import sys
import HOMARD
import salome
REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
REP_PYTHON = os.path.normpath(REP_PYTHON)
sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
- DIRCASE = os.path.join("/tmp", TEST_NAME)
- if ( os.path.isdir(DIRCASE) ) :
- remove_dir(DIRCASE)
- os.mkdir(DIRCASE)
-else :
- DIRCASE = tempfile.mkdtemp(prefix=TEST_NAME)
-# Repertoire des donnees du tutorial
-DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
-DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE, DATA_TUTORIAL = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+# ==================================
sys.path.append(DATA_TUTORIAL)
from tutorial_util import gzip_gunzip
# ==================================
XAO_FILE = os.path.join(DATA_TUTORIAL, TEST_NAME+".xao")
try:
ERREUR, MESSAGE = homard_exec("PIQUAGE", FICMED, XAO_FILE, DEBUG)
- except Exception, eee:
+ except RuntimeError as eee:
ERREUR = 2
- MESSAGE = eee.message
+ MESSAGE = str(eee.message)
#
if ERREUR :
MESSAGE += "Pb in homard_exec"
Python script for HOMARD
Test tutorial_5 associe au tutorial 5
"""
-__revision__ = "V4.02"
+__revision__ = "V4.03"
#========================================================================
TEST_NAME = "tutorial_5"
N_ITER_TEST_FILE = 2
#========================================================================
import os
-import tempfile
import sys
import HOMARD
import salome
REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
REP_PYTHON = os.path.normpath(REP_PYTHON)
sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
- DIRCASE = os.path.join("/tmp", TEST_NAME)
- if ( os.path.isdir(DIRCASE) ) :
- remove_dir(DIRCASE)
- os.mkdir(DIRCASE)
-else :
- DIRCASE = tempfile.mkdtemp(prefix=TEST_NAME)
-# Repertoire des donnees du tutorial
-DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
-DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE, DATA_TUTORIAL = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+# ==================================
sys.path.append(DATA_TUTORIAL)
from tutorial_util import gzip_gunzip
# ==================================
FICFRMED = os.path.join(DATA_TUTORIAL, TEST_NAME+".fr.med")
try:
ERREUR, MESSAGE = homard_exec("COEUR_2D", FICMED, "MAIL_EXT", FICFRMED, DEBUG)
- except Exception, eee:
+ except RuntimeError as eee:
ERREUR = 2
- MESSAGE = eee.message
+ MESSAGE = str(eee.message)
#
if ERREUR :
MESSAGE += "Pb in homard_exec"
Python script for HOMARD
Test tutorial_6 associe au tutorial 6
"""
-__revision__ = "V4.02"
+__revision__ = "V4.03"
#========================================================================
TEST_NAME = "tutorial_6"
N_ITER_TEST_FILE = 3
#========================================================================
import os
-import tempfile
import sys
import HOMARD
import salome
REP_PYTHON = os.path.join(PATH_HOMARD, "bin", "salome", "test", "HOMARD")
REP_PYTHON = os.path.normpath(REP_PYTHON)
sys.path.append(REP_PYTHON)
-from test_util import remove_dir
+from test_util import get_dir
from test_util import test_results
-# Repertoire des donnees du test
-REP_DATA = os.path.join(PATH_HOMARD, "share", "salome", "homardsamples")
-REP_DATA = os.path.normpath(REP_DATA)
-# Repertoire des resultats
-if DEBUG :
- DIRCASE = os.path.join("/tmp", TEST_NAME)
- if ( os.path.isdir(DIRCASE) ) :
- remove_dir(DIRCASE)
- os.mkdir(DIRCASE)
-else :
- DIRCASE = tempfile.mkdtemp(prefix=TEST_NAME)
-# Repertoire des donnees du tutorial
-DATA_TUTORIAL = os.path.join(PATH_HOMARD, "share", "doc", "salome", "gui", "HOMARD", "fr", "_downloads")
-DATA_TUTORIAL = os.path.normpath(DATA_TUTORIAL)
+# ==================================
+# Répertoires pour ce test
+REP_DATA, DIRCASE, DATA_TUTORIAL = get_dir(PATH_HOMARD, TEST_NAME, DEBUG)
+# ==================================
sys.path.append(DATA_TUTORIAL)
from tutorial_util import gzip_gunzip
# ==================================
FICFRMED = os.path.join(DATA_TUTORIAL, TEST_NAME+".fr.med")
try:
ERREUR, MESSAGE = homard_exec("PIQUAGE", FICMED, "COURBES", FICFRMED, DEBUG)
- except Exception, eee:
+ except RuntimeError as eee:
ERREUR = 2
- MESSAGE = eee.message
+ MESSAGE = str(eee.message)
#
if ERREUR :
MESSAGE += "Pb in homard_exec"