-
Notifications
You must be signed in to change notification settings - Fork 441
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
Fix matplotlib backend setting for test suite #2828
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2828 +/- ##
==========================================
+ Coverage 94.00% 94.02% +0.02%
==========================================
Files 76 76
Lines 16390 16405 +15
==========================================
+ Hits 15407 15425 +18
+ Misses 983 980 -3 |
Nice work! We might not even need to add in much of the logic in #2823. We can just check if
I think it's a good idea to add it in. This will stop us from changing it and seeing our tests fail (intermittently). |
I think it's good to have, especially since it doesn't impact many tests. It's good to have an independent safety net to protect against things blowing up in CI. Even if we don't expect it to be necessary. Question is whether it's too much of a maintenance burden going forward.
OK, thanks, I've added it. Created a new file called |
It should be minimal. |
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.
Are we going to require the usage of matplotlib
for our test suite? #2823 makes it optional, which means this metatest will fail immediately without matplotlib
.
Good catch, thanks. This test should only fail if |
So this is interesting: VTK seems to depend on $ python3 -mvenv tmpenv
$ . tmpenv/bin/activate
(tmpenv) $ pip install vtk
[snip]
(tmpenv) $ pip freeze
aiohttp==3.8.1
aiosignal==1.2.0
async-timeout==4.0.2
attrs==21.4.0
charset-normalizer==2.1.0
cycler==0.11.0
fonttools==4.33.3
frozenlist==1.3.0
idna==3.3
kiwisolver==1.4.3
matplotlib==3.5.2
multidict==6.0.2
numpy==1.22.4
packaging==21.3
Pillow==9.1.1
pyparsing==3.0.9
python-dateutil==2.8.2
six==1.16.0
vtk==9.1.0
wslink==1.6.5
yarl==1.7.2 I will still make the test optional, but it all might be a moot point. Unless we change the backend from VTK to something else ;) |
According to
|
Regardless, we need this PR: Thanks for looking into this. Didn't realize VTK depended on |
This is to complement #2823.
The backend choice issue got me thinking. We only seem to be setting the backend for tests in one place:
pyvista/tests/conftest.py
Lines 11 to 19 in 5d6101b
However, looking at the pytest docs there's no explicit mention of session-scoped fixtures also being autouse (in fact for the example module-scoped fixture the opposite is true: example tests request it).
If I add a dummy test that does
this promptly fails with
pytest -v -k test_mpl_backend
, and changing the fixture to autouse makes this test pass. I think this is what's missing.I wondered if I should actually add this test to the test suite, but it would be sort of a meta-test, testing our test setup rather than the library code. So I've left it out for now, let me know if you think otherwise.