Salome HOME
catch exception on salome_instance, and prefer sys.exit to exit
authorCédric Aguerre <cedric.aguerre@edf.fr>
Thu, 6 Apr 2017 07:54:30 +0000 (09:54 +0200)
committerCédric Aguerre <cedric.aguerre@edf.fr>
Thu, 6 Apr 2017 07:54:30 +0000 (09:54 +0200)
bin/appliskel/salome_tester/salome_test_driver.py
bin/appliskel/salome_tester/salome_test_driver_gui.py
bin/killSalomeWithPort.py

index 60b8fd9a20d347d99529d7db00bd946d4c80adb2..7b119d1765804d61475874548adc55737d26d484 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2015-2017  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -54,7 +54,7 @@ if __name__ == "__main__":
   # first argument
   if not args:
     print "Invalid arguments for salome_test_driver.py. No command defined."
-    exit(1)
+    sys.exit(1)
   _, ext = os.path.splitext(args[0])
   if ext == ".py":
     test_and_args = [sys.executable] + args
@@ -89,10 +89,12 @@ if __name__ == "__main__":
     import traceback
     traceback.print_exc()
     pass
-
-  salome_instance.stop()
+  try:
+    salome_instance.stop()
+  except:
+    pass
   if sys.platform == 'win32':
     timer.cancel()
   print "Exit test with status code:", res
-  exit(res)
+  sys.exit(res)
 #
index 284f9e6247e85ac0b709aabe0d16821e0d928085..7ef53d33f7b3ee45baf77ac2a1b4d8c4daf019ec 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2015-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2015-2017  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -42,7 +42,7 @@ if __name__ == "__main__":
   # first argument
   if not args:
     print "Invalid arguments for salome_test_driver_gui.py. No command defined."
-    exit(1)
+    sys.exit(1)
   _, ext = os.path.splitext(args[0])
   test_and_args = args
 
@@ -71,10 +71,12 @@ if __name__ == "__main__":
     import traceback
     traceback.print_exc()
     pass
-
-  salome_instance.stop()
+  try:
+    salome_instance.stop()
+  except:
+    pass
   if sys.platform == 'win32':
     timer.cancel()
 #  print "Exit test with status code:", res
-#  exit(res)
+#  sys.exit(res)
 #
index 9670329bf363a9f7e90148632e8d6864a837cc4c..fa8953b7c566830afa881bc83d928b625a855142 100755 (executable)
@@ -1,6 +1,6 @@
 #! /usr/bin/env python
 #  -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2017  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -214,7 +214,7 @@ def shutdownMyPort(port, cleanup=True):
         pass
     except:
         pass
-    exit(0) # see (1)
+    sys.exit(0) # see (1)
     pass
 # (1) If --shutdown-servers option is set to 1, session close procedure is
 # called twice: first explicitely by salome command, second by automatic