1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Add a test that the runner script works in environments without pip

This ensures that the runner script can be used in environments where
pip is not installed.
This commit is contained in:
Pradyun Gedam 2022-07-15 12:20:39 +01:00
parent 00e5adf2aa
commit 470b217e8c
No known key found for this signature in database
GPG key ID: FF99710C4332258E

View file

@ -0,0 +1,20 @@
import os
from pathlib import Path
from pip import __version__
from tests.lib import PipTestEnvironment
def test_runner_work_in_environments_with_no_pip(
script: PipTestEnvironment, pip_src: Path
) -> None:
runner = pip_src / "src" / "pip" / "__pip-runner__.py"
# Ensure there's no pip installed in the environment
script.pip("uninstall", "pip", "--yes", use_module=True)
script.pip("--version", expect_error=True)
# The runner script should still invoke a usable pip
result = script.run("python", os.fspath(runner), "--version")
assert __version__ in result.stdout