Skip to content

Commit b5afdd6

Browse files
committed
Fix test to cater for packages leaked into venv
1 parent f86a140 commit b5afdd6

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tests/functional/test_python_option.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,17 @@ def test_python_interpreter(
1111
tmpdir: Path,
1212
shared_data: TestData,
1313
) -> None:
14-
env_path = os.fsdecode(tmpdir / "venv")
14+
env_path = os.fspath(tmpdir / "venv")
1515
env = EnvBuilder(with_pip=False)
1616
env.create(env_path)
1717

1818
result = script.pip("--python", env_path, "list", "--format=json")
19-
assert json.loads(result.stdout) == []
19+
before = json.loads(result.stdout)
20+
21+
# Ideally we would assert that before==[], but there's a problem in CI
22+
# that means this isn't true. See https://github.com/pypa/pip/pull/11326
23+
# for details.
24+
2025
script.pip(
2126
"--python",
2227
env_path,
@@ -26,8 +31,11 @@ def test_python_interpreter(
2631
"--no-index",
2732
"simplewheel==1.0",
2833
)
34+
2935
result = script.pip("--python", env_path, "list", "--format=json")
30-
assert json.loads(result.stdout) == [{"name": "simplewheel", "version": "1.0"}]
36+
installed = json.loads(result.stdout)
37+
assert {"name": "simplewheel", "version": "1.0"} in installed
38+
3139
script.pip("--python", env_path, "uninstall", "simplewheel", "--yes")
3240
result = script.pip("--python", env_path, "list", "--format=json")
33-
assert json.loads(result.stdout) == []
41+
assert json.loads(result.stdout) == before

0 commit comments

Comments
 (0)