test_wheel: Put python DLL on system PATH for FreezeTool unit test

This commit is contained in:
rdb 2023-10-15 14:27:46 +02:00
parent 00c6bee3f6
commit a0ea85d39e

View File

@ -71,7 +71,22 @@ def test_wheel(wheel, verbose=False):
if verbose: if verbose:
test_cmd.append("--verbose") test_cmd.append("--verbose")
exit_code = subprocess.call(test_cmd) # Put the location of the python DLL on the path, for deploy-stub test
# This is needed because venv does not install a copy of the python DLL
env = None
if sys.platform == "win32":
deploy_libs = os.path.join(envdir, "Lib", "site-packages", "deploy_libs")
if os.path.isdir(deploy_libs):
# We have to do this dance because os.environ is case insensitive
env = dict(os.environ)
for key, value in env.items():
if key.upper() == "PATH":
env[key] = deploy_libs + ";" + value
break
else:
env["PATH"] = deploy_libs
exit_code = subprocess.call(test_cmd, env=env)
shutil.rmtree(envdir) shutil.rmtree(envdir)
if exit_code != 0: if exit_code != 0: