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

build-style/python3-module: prefer pytest in do_check #26901

Closed
wants to merge 4 commits into from

Conversation

ahesford
Copy link
Member

@ahesford ahesford commented Dec 3, 2020

Closes #25052.

@ericonr
Copy link
Member

ericonr commented Dec 3, 2020

IIRC there are a couple templates that call pytest as an executable directly, if you want to include those.

@fosslinux
Copy link
Contributor

fosslinux commented Dec 4, 2020

How about tox as well? We could go pytest -> tox -> setuptools

Never mind, I forgot #25052

Comment on lines +27 to +29
if python3 -m pytest --help >/dev/null 2>&1; then
python3 -m pytest ${make_check_args} ${make_check_target}
else
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not against leaving a historical comment like "we don't try to use tox because ...."

msg_warn "No command 'test' defined by setup.py.\n"
return 0
if python3 -m pytest --help >/dev/null 2>&1; then
python3 -m pytest ${make_check_args} ${make_check_target}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is better:

PYTHONPATH="$(cd build/lib* && pwd)" python3 -m pytest ${make_check_args} ${make_check_target}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting PYTHONPATH this way might improve support for testing compiled extensions, but I'm not sure it should be the default. If tests break because they can't be run with the default path (plus ., which is automatically added in the python3 -m pytest form of invocation), maybe that should be a manual override situation.

@ahesford
Copy link
Member Author

ahesford commented Dec 9, 2020

Closed in a3227ff

@ahesford ahesford closed this Dec 9, 2020
@ahesford ahesford deleted the pytest branch December 9, 2020 20:55
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change do_check for python modules
4 participants