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

TST: be more explicit about identifying qt4/qt5 imports #14139

Merged
merged 1 commit into from
May 25, 2019

Conversation

tacaswell
Copy link
Member

closes #14137

It is a bit heavy-handed, but seems better than relying on possibly varying import time collisions from upstreams.

@tacaswell tacaswell added this to the v3.1.0 milestone May 6, 2019
@tacaswell
Copy link
Member Author

force-pushed to fix indentation problem.

@tacaswell tacaswell requested a review from QuLogic May 6, 2019 12:49
@QuLogic
Copy link
Member

QuLogic commented May 6, 2019

This is definitely helpful, though I can't quite figure out how to run one or the other. There doesn't seem to be a way in pytest to select a test based on a marker argument. And setting MPLBACKEND doesn't work since nothing 'locks it in' before the test setup switches backends (to Agg or Qt?Agg later).

Do you think we should add a secondary marker for backends as well?

@tacaswell
Copy link
Member Author

pytest -k Qt4 and pytest -k Qt5 work for me to run one or the other.

(mpl_test) ✘  ~/src/p/matplotlib [fix_qt_tests ✭|⚑ 3]
sharon@17:14  ➤  pytest -k Qt5 -vs lib/matplotlib/tests/test_backend_qt.py 
======================================================================================================== test session starts =========================================================================================================
platform linux -- Python 3.6.8, pytest-4.4.1, py-1.8.0, pluggy-0.9.0 -- /tmp/mpl_test/bin/python3
cachedir: .pytest_cache
rootdir: /home/tcaswell/src/p/matplotlib, inifile: pytest.ini
collected 28 items / 16 deselected / 12 selected                                                                                                                                                                                     

lib/matplotlib/tests/test_backend_qt.py::test_fig_close[Qt5Agg] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt5Agg-shift] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt5Agg-lower] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt5Agg-control] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt5Agg-unicode_upper] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt5Agg-unicode_lower] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt5Agg-alt_control] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt5Agg-control_alt] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt5Agg-modifier_order] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt5Agg-backspace] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt5Agg-backspace_mod] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt5Agg-non_unicode_key] PASSED

============================================================================================== 12 passed, 16 deselected in 0.60 seconds ==============================================================================================
(mpl_test) ✔  ~/src/p/matplotlib [fix_qt_tests ✭|⚑ 3]
sharon@17:14  ➤  pytest -k Qt4 -vs lib/matplotlib/tests/test_backend_qt.py 
======================================================================================================== test session starts =========================================================================================================
platform linux -- Python 3.6.8, pytest-4.4.1, py-1.8.0, pluggy-0.9.0 -- /tmp/mpl_test/bin/python3
cachedir: .pytest_cache
rootdir: /home/tcaswell/src/p/matplotlib, inifile: pytest.ini
collected 28 items / 16 deselected / 12 selected                                                                                                                                                                                     

lib/matplotlib/tests/test_backend_qt.py::test_fig_close[Qt4Agg] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt4Agg-shift] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt4Agg-lower] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt4Agg-control] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt4Agg-unicode_upper] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt4Agg-unicode_lower] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt4Agg-alt_control] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt4Agg-control_alt] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt4Agg-modifier_order] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt4Agg-backspace] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt4Agg-backspace_mod] PASSED
lib/matplotlib/tests/test_backend_qt.py::test_correct_key[Qt4Agg-non_unicode_key] PASSED

============================================================================================== 12 passed, 16 deselected in 0.52 seconds ==============================================================================================
(mpl_test) ✔  ~/src/p/matplotlib [fix_qt_tests ✭|⚑ 3]

@QuLogic
Copy link
Member

QuLogic commented May 6, 2019

Unfortunately, that only works if the tests are parameterized (and thus have a backend name in the test name). There are additional Qt5-specific tests that weren't run in your example (which you can see from selected vs deselected counts).

@timhoffm
Copy link
Member

timhoffm commented May 6, 2019

I think, explicit backend selection for the tests is a different topic. But will leave open for now in case somebody feels the need to address it in this PR. Anybody can merge, if there's no further change wanted on the PR.

@tacaswell tacaswell modified the milestones: v3.1.0, v3.1.1 May 18, 2019
@efiring efiring merged commit 2b1a11c into matplotlib:master May 25, 2019
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request May 25, 2019
efiring added a commit that referenced this pull request May 25, 2019
…139-on-v3.1.x

Backport PR #14139 on branch v3.1.x (TST: be more explicit about identifying qt4/qt5 imports)
@tacaswell tacaswell deleted the fix_qt_tests branch January 20, 2020 00:43
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.

Qt5 test auto-skip is not working correctly
5 participants