mplcairo icon indicating copy to clipboard operation
mplcairo copied to clipboard

Pytest hooks not doing anything?

Open QuLogic opened this issue 3 years ago • 5 comments

My Fedora builds are failing because of test_lazy_auto_backend_selection. However, even with c0bbfcf322facdfc7b5ee7767ff8b86d7f5833ad patched in, that test still runs.

I tried patching pytest_collection_modifyitems to always apply debugskip, yet all tests seemed to be running. I then tried adding a raise at the beginning of the function, and it never failed.

So I'm beginning to wonder if the pytest hooks are being used at all? This is with pytest 7.1.2 if perhaps something changed there to break it.

QuLogic avatar Jun 30 '22 07:06 QuLogic

Strange, this is what I get locally:

$ python run-mpl-test-suite.py --pyargs matplotlib.tests.test_backends_interactive -vsk auto_backend_selection
Test session starts (platform: linux, Python 3.10.5, pytest 7.1.2, pytest-sugar 0.9.4)
cachedir: .pytest_cache
hypothesis profile 'default' -> database=DirectoryBasedExampleDatabase('/home/antony/src/local/mplcairo/.hypothesis/examples')
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/antony/src/extern/matplotlib/lib
plugins: sugar-0.9.4, hypothesis-6.17.0, cov-3.0.0, napari-plugin-engine-0.2.0, forked-1.4.0, xdist-2.5.0, anyio-3.6.1, benchmark-3.4.1, napari-0.4.15
collecting ... 
 matplotlib/tests/test_backends_interactive.py::test_lazy_auto_backend_selection s100% ██████████
=================================== short test summary info ====================================
SKIPPED [1] ../../extern/matplotlib/lib/matplotlib/tests/test_backends_interactive.py: Subprocess-based test; cannot patch agg.

Results (0.21s):
       1 skipped
     116 deselected

so the hook certainly works here. The test is skipped on CI too...

anntzer avatar Jul 03 '22 18:07 anntzer

Are you running against installed mplcairo, or an editable install?

QuLogic avatar Jul 29 '22 22:07 QuLogic

It was with an editable install, but I have now tried with a normal install of mplcairo and matplotlib (in a clean venv) and everything works fine too..

anntzer avatar Aug 01 '22 23:08 anntzer

I've worked around this by explicitly passing -k not test_backends_interactive to run-mpl-test-suite.py,

QuLogic avatar Aug 20 '22 20:08 QuLogic

Can I close this then? The whole thing is a bit fuzzy to me, sorry...

anntzer avatar Aug 21 '22 20:08 anntzer

Closing, as I don't really have anything actionable here :/

anntzer avatar Apr 16 '23 11:04 anntzer