Ronald Oussoren avatar 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,
     ),
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.