[Erp5-report] r33173 luke - /erp5/trunk/buildout/tests/assertSoftware.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Mar 1 11:51:18 CET 2010


Author: luke
Date: Mon Mar  1 11:51:17 2010
New Revision: 33173

URL: http://svn.erp5.org?rev=33173&view=rev
Log:
 - check that generated python script is usable as python interpreter

Modified:
    erp5/trunk/buildout/tests/assertSoftware.py

Modified: erp5/trunk/buildout/tests/assertSoftware.py
URL: http://svn.erp5.org/erp5/trunk/buildout/tests/assertSoftware.py?rev=33173&r1=33172&r2=33173&view=diff
==============================================================================
--- erp5/trunk/buildout/tests/assertSoftware.py [utf8] (original)
+++ erp5/trunk/buildout/tests/assertSoftware.py [utf8] Mon Mar  1 11:51:17 2010
@@ -1,5 +1,5 @@
 import unittest
-import sys, os
+import sys, os, tempfile, stat
 
 def createCleanList(s):
   return sorted([q.strip() for q in s.split() if len(q.strip()) > 0])
@@ -7,6 +7,25 @@
 class AssertPythonSoftware(unittest.TestCase):
   def test_python_version(self):
     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):
     required_library_list = createCleanList("""




More information about the Erp5-report mailing list