-
Notifications
You must be signed in to change notification settings - Fork 105
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
Enable pytest4 #116
base: master
Are you sure you want to change the base?
Enable pytest4 #116
Conversation
PY3 = sys.version_info[0] == 3 | ||
PY2 = sys.version_info[0] == 2 | ||
|
||
PYTEST4 = pytest and pytest.__version__ >= '4.0.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't do the same as the PY2
and PY3
constants above. It also evaluates to True
if the runner is nose or unittest but when pytest is importable.
Workaround: add detect_runner() == 'pytest'
to any conditional using it.
PY3 = sys.version_info[0] == 3 | ||
PY2 = sys.version_info[0] == 2 | ||
|
||
PYTEST4 = pytest and pytest.__version__ >= '4.0.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also note that e.g. '10.0.0' is lower than '4.0.0'. Something like this should work:
PYTEST4 = pytest and pytest.__version__ >= '4.0.0' | |
PYTEST4 = pytest and int(pytest.__version__.split('.')[0]) >= 4 |
I've been tryimg to test this PR and pytest was not able to find units + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-parameterized-0.8.1-3.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-parameterized-0.8.1-3.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/parameterized-0.8.1
collected 0 items
========================================================================== no tests ran in 0.01s =========================================================================== |
After add + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-parameterized-0.8.1-3.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-parameterized-0.8.1-3.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra --pyargs parameterized.test
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/parameterized-0.8.1
collected 0 items / 1 error
================================================================================== ERRORS ==================================================================================
______________________________________________________________________ ERROR collecting test session _______________________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILDROOT/python-parameterized-0.8.1-3.fc35.x86_64/usr/lib/python3.8/site-packages/parameterized/test.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
../../BUILDROOT/python-parameterized-0.8.1-3.fc35.x86_64/usr/lib/python3.8/site-packages/parameterized/test.py:6: in <module>
from nose.tools import assert_equal, assert_raises
E ModuleNotFoundError: No module named 'nose'
========================================================================= short test summary info ==========================================================================
ERROR
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
============================================================================= 1 error in 0.10s ============================================================================= Test suite shoud be rewrited to use pytest as |
See the full Fedora's patch: https://src.fedoraproject.org/rpms/python-parameterized/blob/rawhide/f/pytest4.patch And the way we run the tests: https://src.fedoraproject.org/rpms/python-parameterized/blob/rawhide/f/python-parameterized.spec#_47 |
On migration to pytest usefull could be https://github.com/schollii/nose2pytest/ |
OK. Is it possible to update this PR? |
Possible? Probably yes |
OK so my understandimg is that to update this PR it needas to be submittdd PR against forked repo and if @wolever will accept that PR thos PR will be updated as well. |
Or submit another one. |
thanks @hroncok ! i've applied the Fedora's patch to the debian package and now tests are passing with pytest 7 |
I tried to rebase this on |
No description provided.