Salome HOME
[PY3] Still porting test...
[modules/yacs.git] / src / yacsloader_swig / Test / testProgress.py
index ca8cee59b3a43d7c393fa6085e5408a0423c424b..c9aea65dbd0305786b7a400228b3841ca04bc854 100755 (executable)
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2015  CEA/DEN, EDF R&D
+# Copyright (C) 2006-2016  CEA/DEN, EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -133,9 +133,8 @@ class TestEdit(unittest.TestCase):
 if __name__ == '__main__':
   import os
   U = os.getenv('USER')
-  f=open("/tmp/" + U + "/UnitTestsResult", 'a')
-  f.write("  --- TEST src/yacsloader: testProgress.py\n")
-  suite = unittest.makeSuite(TestEdit)
-  result=unittest.TextTestRunner(f, descriptions=1, verbosity=3).run(suite)
-  f.close()
+  with open("/tmp/" + U + "/UnitTestsResult", 'a') as f:
+      f.write("  --- TEST src/yacsloader: testProgress.py\n")
+      suite = unittest.makeSuite(TestEdit)
+      result=unittest.TextTestRunner(f, descriptions=1, verbosity=3).run(suite)
   sys.exit(not result.wasSuccessful())