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,20 +10,17 @@ class AssertPythonSoftware(unittest.TestCase):
def test_use_generated_python(self):
fd, name = tempfile.mkstemp()
f = os.fdopen(fd, 'w')
f.write("""\
try:
f = os.fdopen(fd, 'w')
f.write("""\
#!%s
import sys
print sys.version_info[:2]
""" % sys.executable)
f.close()
f_stat = os.stat(name)
os.chmod(name, f_stat.st_mode | stat.S_IXUSR)
try:
try:
self.assertEqual(0, os.system(name))
except:
raise
f.close()
f_stat = os.stat(name)
os.chmod(name, f_stat.st_mode | stat.S_IXUSR)
self.assertEqual(0, os.system(name))
finally:
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