Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running pytest fails if pip doesn't have permissions to install packages #63

Open
filbranden opened this issue Jan 8, 2021 · 3 comments

Comments

@filbranden
Copy link

filbranden commented Jan 8, 2021

The problem seems to be in tests/test_datafiles_install.py which tries to execute a bare pip install .

A somewhat easy workaround would be to set up a temporary directory and export PIP_TARGET=/path/to/tmp/staging before running each test that tries to pip install.

UPDATE: Also seems to affect tests/test_install.py.

@frenzymadness
Copy link
Contributor

Also, it would be nice to make it possible to easily skip those tests in environments without internet access.

@frenzymadness
Copy link
Contributor

Oh, I misunderstand the issue, sorry. Now I see it. If I run the tests as a regular user, it tries to install packages into /usr/jupyter-packaging-test… which is not possible for obvious reasons. It seems that the tests are using sys.base_prefix as a root directory. Wouldn't it be better to use pytest fixture tmp_path?

@blink1073
Copy link
Member

Taking note of two things we need for this:

  • Add a pytest marker for tests that require downloads
  • Use a pytest fixture that creates a venv for anything that is going to invoke pip install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants