Add TEST_ENVIRONMENT option and set PYTHONSAFEPATH=1 in the test env (#2388)

* Add TEST_ENVIRONMENT option and set PYTHONSAFEPATH=1 in the test env

Closes https://github.com/pypa/cibuildwheel/issues/2358

* Add toml docs examples

* Add TOML examples

* Use double-quotes for windows
This commit is contained in:
Joe Rickerby
2025-05-20 13:41:26 +01:00
committed by GitHub
parent 9dd7192d89
commit fcdbed860e
11 changed files with 146 additions and 5 deletions
+7
View File
@@ -558,6 +558,13 @@ def build(options: Options, tmp_path: Path) -> None:
pip_version=pip_version,
)
# see https://github.com/pypa/cibuildwheel/issues/2358 for discussion
virtualenv_env["PYTHONSAFEPATH"] = "1"
virtualenv_env = build_options.test_environment.as_dictionary(
prev_environment=virtualenv_env
)
# check that we are using the Python from the virtual environment
call("where", "python", env=virtualenv_env)