(original) (raw)

changeset: 103580:94563ec74e1d branch: 3.5 parent: 103578:9eb0f7762999 user: Steve Dower steve.dower@microsoft.com date: Sat Sep 10 12:19:42 2016 -0700 files: Lib/test/test_platform.py description: Closes #28059: Fixes test_platform to set PYTHONPATH for .pyd files diff -r 9eb0f7762999 -r 94563ec74e1d Lib/test/test_platform.py --- a/Lib/test/test_platform.py Sat Sep 10 20:17:36 2016 +0100 +++ b/Lib/test/test_platform.py Sat Sep 10 12:19:42 2016 -0700 @@ -15,11 +15,18 @@ @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', /steve.dower@microsoft.com