Skip to content

Commit 470b217

Browse files
committed
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.
1 parent 00e5adf commit 470b217

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import os
2+
from pathlib import Path
3+
4+
from pip import __version__
5+
from tests.lib import PipTestEnvironment
6+
7+
8+
def test_runner_work_in_environments_with_no_pip(
9+
script: PipTestEnvironment, pip_src: Path
10+
) -> None:
11+
runner = pip_src / "src" / "pip" / "__pip-runner__.py"
12+
13+
# Ensure there's no pip installed in the environment
14+
script.pip("uninstall", "pip", "--yes", use_module=True)
15+
script.pip("--version", expect_error=True)
16+
17+
# The runner script should still invoke a usable pip
18+
result = script.run("python", os.fspath(runner), "--version")
19+
20+
assert __version__ in result.stdout

0 commit comments

Comments
 (0)