Salome HOME
Use /tmp for temporary files needed by salome tests.
[modules/yacs.git] / src / yacsloader_swig / Test / testProgress.py
index d9567343ba6cb534272cc818dbfe7e0018c8d464..740159724c36c017255db218eaffa452d34b2827 100755 (executable)
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2016  CEA/DEN, EDF R&D
+# Copyright (C) 2006-2019  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())