Commits

Ronald Oussoren committed 00ba676

Small tweaks to make it possible to test with python 2.5

(Patch is likely incomplete as my 2.5 install doesn't have unittest2 yet
and I don't have internet access right now)

Comments (0)

Files changed (2)

py2app_tests/test_basic_app.py

 
 DIR_NAME=os.path.dirname(os.path.abspath(__file__))
 
+if sys.version_info[0] == 2:
+    def B(value):
+        return value
+
+else:
+    def B(value):
+        return value.encode('latin1')
+
+
+
 
 class TestBasicApp (unittest.TestCase):
     py2app_args = []
         p.stdin.write('import_module("os")\n'.encode('latin1'))
         p.stdin.flush()
         ln = p.stdout.readline()
-        self.assertEqual(ln.strip(), b"os")
+        self.assertEqual(ln.strip(), B("os"))
 
         # Dependency of the main module:
         p.stdin.write('import_module("decimal")\n'.encode('latin1'))
         p.stdin.flush()
         ln = p.stdout.readline()
-        self.assertEqual(ln.strip(), b"decimal")
+        self.assertEqual(ln.strip(), B("decimal"))
 
         if '--alias' not in self.py2app_args:
             # Not a dependency of the module (stdlib):
     extra_args = dict()
 
 
+if sys.version_info[0] == 3 or (sys.version_info[:2] >= (2,7)):
+    tests_require = []
+else:
+    tests_require = ['unittest2']
+
+
+
+
 
 def test_loader():
     import unittest
         try:
             module = __import__(modName)
         except ImportError:
-            print ("SKIP %s: %s"%(modName, sys.exc_info[1]))
+            print ("SKIP %s: %s"%(modName, sys.exc_info()[1]))
             continue
 
         s = unittest.defaultTestLoader.loadTestsFromModule(module)
         "modulegraph>=0.8.1",
         "macholib>=1.3",
     ],
+    tests_require=tests_require,
     cmdclass=dict(
         upload_docs=upload_docs,
     ),