Commit ba41c37c authored by Łukasz Nowak's avatar Łukasz Nowak

- use only try..finally, it is enough

 - put all possible-to-fail code in try block


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33174 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b9888f70
...@@ -10,6 +10,7 @@ class AssertPythonSoftware(unittest.TestCase): ...@@ -10,6 +10,7 @@ class AssertPythonSoftware(unittest.TestCase):
def test_use_generated_python(self): def test_use_generated_python(self):
fd, name = tempfile.mkstemp() fd, name = tempfile.mkstemp()
try:
f = os.fdopen(fd, 'w') f = os.fdopen(fd, 'w')
f.write("""\ f.write("""\
#!%s #!%s
...@@ -19,11 +20,7 @@ print sys.version_info[:2] ...@@ -19,11 +20,7 @@ print sys.version_info[:2]
f.close() f.close()
f_stat = os.stat(name) f_stat = os.stat(name)
os.chmod(name, f_stat.st_mode | stat.S_IXUSR) os.chmod(name, f_stat.st_mode | stat.S_IXUSR)
try:
try:
self.assertEqual(0, os.system(name)) self.assertEqual(0, os.system(name))
except:
raise
finally: finally:
os.unlink(name) os.unlink(name)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment