python-setuptools/Isolate-spawned-processes-by-unsetting-PYTHONPATH.patch
Karolina Surma 748e1cb28e Update to 60.9.3
- change license string
- change wheel size test to 800 KiB (there are more bundled libraries)
- backport upstream patches to run more tests without the internet
  connection
2022-03-11 08:41:41 +01:00

44 lines
1.4 KiB
Diff

From 395edd9c8f055005922b8e66a21ba9f0d2a7c2fd Mon Sep 17 00:00:00 2001
From: Karolina Surma <ksurma@redhat.com>
Date: Thu, 24 Feb 2022 09:38:54 +0100
Subject: [PATCH] Isolate spawned processes by unsetting PYTHONPATH
---
setuptools/tests/environment.py | 5 +++++
setuptools/tests/fixtures.py | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/setuptools/tests/environment.py b/setuptools/tests/environment.py
index a0c0ec6..b0eac3a 100644
--- a/setuptools/tests/environment.py
+++ b/setuptools/tests/environment.py
@@ -18,6 +18,11 @@ class VirtualEnv(jaraco.envs.VirtualEnv):
def run(self, cmd, *args, **kwargs):
cmd = [self.exe(cmd[0])] + cmd[1:]
kwargs = {"cwd": self.root, **kwargs} # Allow overriding
+ if "env" not in kwargs:
+ env = dict(os.environ)
+ if "PYTHONPATH" in env:
+ del env["PYTHONPATH"]
+ kwargs["env"] = env
return subprocess.check_output(cmd, *args, **kwargs)
diff --git a/setuptools/tests/fixtures.py b/setuptools/tests/fixtures.py
index 7599e65..d61ffa4 100644
--- a/setuptools/tests/fixtures.py
+++ b/setuptools/tests/fixtures.py
@@ -98,7 +98,8 @@ def venv(tmp_path, setuptools_wheel):
env = environment.VirtualEnv()
env.root = path.Path(tmp_path / 'venv')
env.req = str(setuptools_wheel)
- return env.create()
+ with contexts.environment(PYTHONPATH=None):
+ return env.create()
@pytest.fixture
--
2.35.1