-
Notifications
You must be signed in to change notification settings - Fork 55
Description
test_path_pollution (added with 1.2.0) fails with:
_____________________________ test_path_pollution ______________________________
def test_path_pollution():
hooks = get_hooks("path-pollution")
with TemporaryDirectory() as outdir:
with modified_env(
{
"PYTHONPATH": BUILDSYS_PKGS,
"TEST_POLLUTION_OUTDIR": outdir,
}
):
hooks.get_requires_for_build_wheel({})
with open(pjoin(outdir, "out.json")) as f:
captured_sys_path = json.load(f)
with in_proc_script_path() as path:
assert os.path.dirname(path) not in captured_sys_path
> assert captured_sys_path[0] == BUILDSYS_PKGS
E AssertionError: assert '/usr/src/RPM...s/_in_process' == '/usr/src/RPM...buildsys_pkgs'
E
E - /usr/src/RPM/BUILD/python3-module-pyproject_hooks-1.2.0/tests/samples/buildsys_pkgs
E + /usr/src/RPM/BUILD/python3-module-pyproject_hooks-1.2.0/.run_venv/lib/python3/site-packages/pyproject_hooks/_in_process
According to the description of f71a8f5 this test checks if _in_process path is not on a head of sys.path.
In virtual environment created with stdlib's venv lib64 directory is a link to lib, while virtualenv (the default backend for nox) does create both lib64 and lib directories.
In the code for removal of _in_process https://github.com/pypa/pyproject-hooks/blob/main/src/pyproject_hooks/_in_process/_in_process.py#L363-L365
__file__ contains not resolved path. But during a hook call (python abspath(str(script))) getcwd() is called which does resolve path and that path is inserted into beginning of sys.path.
In virtual environments containing lib64 symlink the _in_process path's parent directory is not cleaned up from sys.path.