Skip to content

Commit

Permalink
Explicitly disable the new --user default in pip
Browse files Browse the repository at this point in the history
  • Loading branch information
betatim committed Jan 25, 2020
1 parent 386683b commit fb67438
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions integration-tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def test_installer_log_readable():
assert file_stat.st_uid == 0
assert file_stat.st_mode == 0o100500


@pytest.mark.parametrize("group", [ADMIN_GROUP, USER_GROUP])
def test_user_env_readable(group):
# every file in user env should be readable by everyone
Expand Down Expand Up @@ -163,8 +164,15 @@ def test_pip_install(group, allowed):
python = os.path.join(USER_PREFIX, "bin", "python")

with context:
# we explicitly add `--no-user` here even though a real user wouldn't
# With this test we want to check that a user can't install to the
# global site-packages directory. In new versions of pip the default
# behaviour is to install to a user location when a global install
# isn't possible. By using --no-user we disable this behaviour and
# get a failure if the user can't install to the global site. Which is
# what we wanted to test for here.
subprocess.check_call(
[python, "-m", "pip", "install", "--ignore-installed", "--no-deps", "flit"],
[python, "-m", "pip", "install", "--no-user", "--ignore-installed", "--no-deps", "flit"],
preexec_fn=partial(setgroup, group),
)
if allowed:
Expand Down Expand Up @@ -215,4 +223,4 @@ def test_symlinks():
"""
Test we symlink tljh-config to /usr/local/bin
"""
assert os.path.exists('/usr/bin/tljh-config')
assert os.path.exists('/usr/bin/tljh-config')

0 comments on commit fb67438

Please sign in to comment.