bwoodsend/vtkplotlib

Error with Sys module when trying to make pipenv with extended test dependencies

Closed this issue · 2 comments

Steps to reproduce:

  • Pull fresh repo
  • run pipenv install to create a pipenv
  • run pipenv install '-e .[test]' to get pipenv to create an environment with required dependencies

Result:
ModuleNotFoundError: No module named 'sys.version_info'; 'sys' is not a package

Excuse me, I'm new to setup.py and I might be missing something here. Any suggestions on what extra I could do to easily make a pipenv environment capable of running the unit tests in this repo?

Firstly, there is no extra called test on this repo:

vtkplotlib/setup.py

Lines 49 to 54 in c1f305d

extras_require={
"test_minimal": ["pytest"],
"test_full": ["pytest",
"PyQt5" if sys.version_info.major >= 3 else "python_qt5",
"numpy-stl", "namegenerator", "PILLOW"],
},

There is a test_minimal which currently just adds pytest, and a test_full which includes all the optional stuff so it should be either of those inside the square brakets.


I'm not a pipenv user (prefer plain old venv) so I don't know if this is correct usage but this appeared to work for me:

pipenv install
pipenv shell
pip install -e .[test_minimal]

Then you should be able to launch the test suite via pytest:

pytest

Just running it now I see a couple of breakages have trickled in so don't be surprised if these fail:

FAILED tests/test_imageio.py::test_read[JPEG-True] - assert False
FAILED tests/test_imageio.py::test_read[JPEG-False] - assert False
FAILED tests/test_misc.py::test_data - AssertionError

Thanks for the details. Your recommendations do result in a pipenv virtual environment with the required dependencies.

However it's a bit of a work-around. When you install dependencies from within the pipenv shell, they aren't tracked in the pipfile. I did a bit of digging and it looks like there is an open issue with pipenv when installing from setup.py if the setup.py needs to be evaluated first (pypa/pipenv#4309).

This is out of scope of vtkplotlib so I'll close this issue for now