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

Install pytest and pytest-cov using pip rather than pacman #5231

Merged
merged 1 commit into from
Jan 28, 2021

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented Jan 27, 2021

Fixes an error that has started appearing on MSYS jobs. Seen in #5230 (https://github.com/python-pillow/Pillow/pull/5230/checks?check_run_id=1779961003#step:6:32) and #5232, and will presumably be seen in master with the next merge.

Running selftest:
--- 58 tests passed.
Traceback (most recent call last):
  File "C:/msys64/mingw64/lib/python3.8/runpy.py", line 185, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "C:/msys64/mingw64/lib/python3.8/runpy.py", line 144, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "C:/msys64/mingw64/lib/python3.8/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "C:/msys64/mingw64/lib/python3.8/site-packages/pytest/__init__.py", line 5, in <module>
    from _pytest.assertion import register_assert_rewrite
  File "C:/msys64/mingw64/lib/python3.8/site-packages/_pytest/assertion/__init__.py", line 9, in <module>
    from _pytest.assertion import rewrite
  File "C:/msys64/mingw64/lib/python3.8/site-packages/_pytest/assertion/rewrite.py", line 33, in <module>
    from _pytest._version import version
ModuleNotFoundError: No module named '_pytest._version'

@nulano
Copy link
Contributor

nulano commented Jan 28, 2021

It seems the issue isn't pytest-cov, but pytest. Not sure why, but this change also makes pip upgrade pytest to 6.2.2, which is actually what is fixing this issue. See also: msys2/MINGW-packages#7690 (comment)

Edit: Also found msys2/MINGW-packages#7806, maybe that will fix it once it is in the package repo?

@radarhere
Copy link
Member Author

Keeping pytest and pytest-cov pacman with pytest>=6.2.2 still failed somehow.

Switching both pytest and pytest-cov from pacman to pip did pass, so that is an alternative to this PR - not a problem, but I also don't see the advantage.

@nulano
Copy link
Contributor

nulano commented Jan 28, 2021

Haven't tested it, but I suspect python3 -m pip install pyroma pytest>=6.2.2 is interpreted as python3 -m pip install pyroma pytest with output redirected to the file =6.2.2, which doesn't update pytest because it is already installed (although pip thinks it's version 0.0.0).

Switching both pytest and pytest-cov from pacman to pip did pass, so that is an alternative to this PR - not a problem, but I also don't see the advantage.

A (very slightly) shorter install time would be one advantage, since pytest wouldn't have to be installed twice.

@radarhere radarhere changed the title Install pytest-cov using pip rather than pacman Install pytest and pytest-cov using pip rather than pacman Jan 28, 2021
@radarhere
Copy link
Member Author

Ah - python3 -m pip install pyroma "pytest>=6.2.2" does work.

Ok, I've changed this PR to swapping both pacman lines for pip.

@hugovk
Copy link
Member

hugovk commented Jan 28, 2021

In general, is there an advantage to installing via pacman instead of pip?

@nulano
Copy link
Contributor

nulano commented Jan 28, 2021

For binary packages, the advantage is much shorter install times (no need to compile), and sometimes there might be a patch applied to the pacman version needed to get a package to work. I wouldn't expect much of a difference for pure-python packages such as pytest (pytest and pytest-cov don't have any patches, just an install script for the pytest.exe binaries). So for pytest, it might be better to use pip simply because it is updated more frequently.

My understanding is that MSYS2 provides pacman packages only for those libraries that require patches, and their dependencies. Pytest is likely only available because it is a dependency of something else.

@hugovk
Copy link
Member

hugovk commented Jan 28, 2021

Pytest does update quite frequently, and like you say, is pure Python. Pytest is a dependency at least for lots of pytest plugins, perhaps there's one of those which needs building.

Anyway, let's go with this PR. Can always switch back if needed. Thanks both!

@hugovk hugovk merged commit dfc6cf7 into python-pillow:master Jan 28, 2021
@radarhere radarhere deleted the pytest branch January 28, 2021 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants