Skip to content

Commit b62ef2b

Browse files
committed
Add the test proposed in pypa#8796 (comment)
1 parent a9e7eb2 commit b62ef2b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
File renamed without changes.

tests/functional/test_install_user.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,3 +327,23 @@ def test_install_user_in_global_virtualenv_with_conflict_fails(
327327
f"Will not install to the user site because it will lack sys.path "
328328
f"precedence to pkg in {dist_location}"
329329
) in result2.stderr
330+
331+
def test_install_user_nositepkgs_fails(
332+
self, script: PipTestEnvironment, data: TestData
333+
) -> None:
334+
"""
335+
Test that --user install fails when user site-packages are disabled.
336+
"""
337+
run_from = data.packages.joinpath("FSPkg")
338+
result = script.pip(
339+
"install",
340+
"--user",
341+
curdir,
342+
cwd=run_from,
343+
expect_error=True,
344+
env={"PYTHONNOUSERSITE": "1"},
345+
)
346+
assert (
347+
"Can not perform a '--user' install. User site-packages are "
348+
"disabled for this Python." in result.stderr
349+
)

0 commit comments

Comments
 (0)