Commits

Ronald Oussoren committed 384a549

Tests once again pass with python 3.2

NOTE: This updates src/main.c without recompiling the prebuilt
executables. The reason for this is that the machine I'm currently
using doesn't have the SDK support needed to actually build these,
and as I'm at pycon I cannot download a new version of Xcode.

  • Participants
  • Parent commits 5724b71

Comments (0)

Files changed (4)

 syntax: glob
 *.dSYM
 *.pyc
+unittest2-*.egg

py2app/apptemplate/src/main.c

     setenv("LC_CTYPE", "en_US.UTF-8", 1);
 
     if (isPy3K) {
+#if 0
     	if (py2app_Py_SetPath != NULL) {
 		size_t len = (strlen(resource_path) * 3) + 256;
 		char* search_path = malloc(len);
 		/* sys.prefix and sys.exec_prefix aren't set yet */
 		
 	}
+#endif
 
     	wchar_t w_pythonInterpreter[PATH_MAX+1];
     	mbstowcs(w_pythonInterpreter, c_pythonInterpreter, PATH_MAX+1);
     py2app_Py_Initialize();
 
     if (isPy3K && py2app_Py_SetPath) {
+#if 0
 	    PyObject* prefix = py2app_Py_BuildValue(
 		"s", resource_path);
 	    if (prefix == NULL) {
         	rval = report_script_error(ERR_PYTHONEXCEPTION);
 		return rval;
 	    }
+#endif
      }
 
 

py2app_tests/test_basic_plugin.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 TestBasicPlugin (unittest.TestCase):
     py2app_args = []
         p.stdin.flush()
 
         v = p.stdout.readline()
-        self.assertEqual(v.strip(), '+ test startup')
+        self.assertEqual(v.strip(), B('+ test startup'))
 
         p.stdin.close()
         p.stdout.close()
 
 
 def test_loader():
-    import unittest
+    if sys.version_info[0] == 3 or sys.version_info[:2] >= (2, 7):
+        import unittest
+    else:
+        import unittest2 as unittest
 
     topdir = os.path.dirname(os.path.abspath(__file__))
     testModules = [ fn[:-3] for fn in os.listdir(os.path.join(topdir, 'py2app_tests')) if fn.endswith('.py')]