]> granicus.if.org Git - python/commitdiff
Closes #28059: Fixes test_platform to set PYTHONPATH for .pyd files
authorSteve Dower <steve.dower@microsoft.com>
Sat, 10 Sep 2016 19:19:42 +0000 (12:19 -0700)
committerSteve Dower <steve.dower@microsoft.com>
Sat, 10 Sep 2016 19:19:42 +0000 (12:19 -0700)
Lib/test/test_platform.py

index ed18773326a7ea52cb38e16dd46c6834a2ef1468..18de110ecb4601493bbc7c12e6af2a934b8a0e43 100644 (file)
@@ -15,11 +15,18 @@ class PlatformTest(unittest.TestCase):
 
     @support.skip_unless_symlink
     def test_architecture_via_symlink(self): # issue3762
-        # On Windows, the EXE needs to know where pythonXY.dll is at so we have
-        # to add the directory to the path.
+        # On Windows, the EXE needs to know where pythonXY.dll and *.pyd is at
+        # so we add the directory to the path and PYTHONPATH.
         if sys.platform == "win32":
+            def restore_environ(old_env):
+                os.environ.clear()
+                os.environ.update(old_env)
+
+            self.addCleanup(restore_environ, dict(os.environ))
+
             os.environ["Path"] = "{};{}".format(
                 os.path.dirname(sys.executable), os.environ["Path"])
+            os.environ["PYTHONPATH"] = os.path.dirname(sys.executable)
 
         def get(python):
             cmd = [python, '-c',