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

make check doesn't work on vanilla Ubuntu 22.04 #2567

Closed
DimitriPapadopoulos opened this issue Oct 30, 2022 · 6 comments · Fixed by #2568
Closed

make check doesn't work on vanilla Ubuntu 22.04 #2567

DimitriPapadopoulos opened this issue Oct 30, 2022 · 6 comments · Fixed by #2568

Comments

@DimitriPapadopoulos
Copy link
Collaborator

DimitriPapadopoulos commented Oct 30, 2022

⇒ Should we switch from python and pytest to python3 and pytest-3?


  1. Command python is not available by default on a vanilla installation. Package python3-minimal provides python3, and package python-is-python3, which is not installed by default, provides python:
$ make check-distutils
python setup.py check --restructuredtext --strict
make: python: No such file or directory
make: *** [Makefile:51: check-distutils] Error 127
$ 

We call python here:

codespell/Makefile

Lines 50 to 51 in 458de80

check-distutils:
python setup.py check --restructuredtext --strict


  1. Command pytest is not available, instead package python3-pytest provides pytest-3:
$ make pytest
pytest codespell_lib
make: pytest: No such file or directory
make: *** [Makefile:57: pytest] Error 127
$ 

We call pytest here:

codespell/Makefile

Lines 56 to 57 in 458de80

pytest:
pytest codespell_lib

@DimitriPapadopoulos
Copy link
Collaborator Author

Need to run pip install pytest with --upgrade to override pytest-3 provided by the DEB package with the pytest installed by pip:

$ which pytest
$ 
$ dpkg -S `which pytest-3`
python3-pytest: /usr/bin/pytest-3
$ 
$ pip install --user pytest
Requirement already satisfied: pytest in /usr/lib/python3/dist-packages (6.2.5)
$ 
$ pip install --user --upgrade pytest
Requirement already satisfied: pytest in /usr/lib/python3/dist-packages (6.2.5)
Collecting pytest
  Using cached pytest-7.2.0-py3-none-any.whl (316 kB)
Requirement already satisfied: tomli>=1.0.0 in /usr/lib/python3/dist-packages (from pytest) (1.2.2)
Requirement already satisfied: iniconfig in /usr/lib/python3/dist-packages (from pytest) (1.1.1)
Requirement already satisfied: packaging in /usr/lib/python3/dist-packages (from pytest) (21.3)
Requirement already satisfied: attrs>=19.2.0 in /usr/lib/python3/dist-packages (from pytest) (21.2.0)
Requirement already satisfied: pluggy<2.0,>=0.12 in /usr/lib/python3/dist-packages (from pytest) (0.13.0)
Collecting exceptiongroup>=1.0.0rc8
  Using cached exceptiongroup-1.0.0-py3-none-any.whl (12 kB)
Installing collected packages: exceptiongroup, pytest
Successfully installed exceptiongroup-1.0.0 pytest-7.2.0
$ 

@cclauss
Copy link
Contributor

cclauss commented Oct 31, 2022

macOS:

% pytest-3 --version

zsh: command not found: pytest-3

pytest --version

pytest 7.1.2

@peternewman
Copy link
Collaborator

Assuming we don't want to go down the whole configure/autoconf route, would it be worth doing a partial step where we check for in order pytest, pytest-3 and python, python3 and use the first one we find, which I think would fix your errors on a vanilla Ubuntu @DimitriPapadopoulos ?

@DimitriPapadopoulos
Copy link
Collaborator Author

DimitriPapadopoulos commented Nov 3, 2022

Concerning pytest, that's what I had implemented in the Makefile: try pytest then py.test-3.

Concerning python, yes I guess we could do the same in the Makefile; try python, then python3.

I agree these are distribution oddities, that should ideally be addressed by distributions themselves. In the meantime, I thought it would be profitable for codespell to be able to run make check despite these oddities.

@cclauss
Copy link
Contributor

cclauss commented Nov 3, 2022

Lot's of stackoverflow comments say that invoking via py.test is deprecated but I was unable to find anything in the pytest docs that says that explicitly. Their pyproject.toml seems to continue to support it.

https://docs.pytest.org/en/7.2.x/how-to/usage.html#other-ways-of-calling-pytest

Node.js Makefile does PYTHON ?= python3 and then they use $(PYTHON) for all invocations like $(PYTHON) -m pytest. Node.js has gotta work on WIndows.

@larsoner
Copy link
Member

larsoner commented Nov 3, 2022

I wouldn't bother working around the python3 stuff. I'd rather tell people to alias in their terminal or use some similar fix. At least the other projects I work on don't try to accommodate the python3-style names, so AFAIK the most common practice is to have people fix things at their end so python ... itself can work

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

Successfully merging a pull request may close this issue.

4 participants