mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Fix test to cater for packages leaked into venv
This commit is contained in:
parent
f86a140b12
commit
b5afdd6048
|
@ -11,12 +11,17 @@ def test_python_interpreter(
|
|||
tmpdir: Path,
|
||||
shared_data: TestData,
|
||||
) -> None:
|
||||
env_path = os.fsdecode(tmpdir / "venv")
|
||||
env_path = os.fspath(tmpdir / "venv")
|
||||
env = EnvBuilder(with_pip=False)
|
||||
env.create(env_path)
|
||||
|
||||
result = script.pip("--python", env_path, "list", "--format=json")
|
||||
assert json.loads(result.stdout) == []
|
||||
before = json.loads(result.stdout)
|
||||
|
||||
# Ideally we would assert that before==[], but there's a problem in CI
|
||||
# that means this isn't true. See https://github.com/pypa/pip/pull/11326
|
||||
# for details.
|
||||
|
||||
script.pip(
|
||||
"--python",
|
||||
env_path,
|
||||
|
@ -26,8 +31,11 @@ def test_python_interpreter(
|
|||
"--no-index",
|
||||
"simplewheel==1.0",
|
||||
)
|
||||
|
||||
result = script.pip("--python", env_path, "list", "--format=json")
|
||||
assert json.loads(result.stdout) == [{"name": "simplewheel", "version": "1.0"}]
|
||||
installed = json.loads(result.stdout)
|
||||
assert {"name": "simplewheel", "version": "1.0"} in installed
|
||||
|
||||
script.pip("--python", env_path, "uninstall", "simplewheel", "--yes")
|
||||
result = script.pip("--python", env_path, "list", "--format=json")
|
||||
assert json.loads(result.stdout) == []
|
||||
assert json.loads(result.stdout) == before
|
||||
|
|
Loading…
Reference in a new issue