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

- check that generated python script is usable as python interpreter


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33173 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c5de1cbb
import unittest import unittest
import sys, os import sys, os, tempfile, stat
def createCleanList(s): def createCleanList(s):
return sorted([q.strip() for q in s.split() if len(q.strip()) > 0]) return sorted([q.strip() for q in s.split() if len(q.strip()) > 0])
...@@ -8,6 +8,25 @@ class AssertPythonSoftware(unittest.TestCase): ...@@ -8,6 +8,25 @@ class AssertPythonSoftware(unittest.TestCase):
def test_python_version(self): def test_python_version(self):
self.assertEqual((2,4), sys.version_info[:2]) self.assertEqual((2,4), sys.version_info[:2])
def test_use_generated_python(self):
fd, name = tempfile.mkstemp()
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
finally:
os.unlink(name)
def test_required_libraries(self): def test_required_libraries(self):
required_library_list = createCleanList(""" required_library_list = createCleanList("""
ERP5Diff ERP5Diff
......
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