fix PYTHONPATH setting for end-to-end tests
authorStefan Behnel <scoder@users.berlios.de>
Mon, 4 Oct 2010 09:24:57 +0000 (11:24 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Mon, 4 Oct 2010 09:24:57 +0000 (11:24 +0200)
runtests.py

index 89d22793e8d46cd04f07f72d2f34fbb59300f4f2..7ee5650c5bb00049174c8181121aa0b23a3bee2b 100644 (file)
@@ -662,11 +662,12 @@ class EndToEndTest(unittest.TestCase):
         commands = (self.commands
             .replace("CYTHON", "PYTHON %s" % os.path.join(self.cython_root, 'cython.py'))
             .replace("PYTHON", sys.executable))
-        commands = """
-        PYTHONPATH="%s%s$PYTHONPATH"
-        %s
-        """ % (self.cython_root, os.pathsep, commands)
-        self.assertEqual(0, os.system(commands))
+        old_path = os.environ.get('PYTHONPATH')
+        try:
+            os.environ['PYTHONPATH'] = self.cython_root + os.pathsep + (old_path or '')
+            self.assertEqual(0, os.system(commands))
+        finally:
+            os.environ['PYTHONPATH'] = old_path
 
 
 # TODO: Support cython_freeze needed here as well.