-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add pytest-xvfb to dev environment #23725
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
Conversation
@@ -56,5 +56,6 @@ dependencies: | |||
- pytest-rerunfailures | |||
- pytest-timeout | |||
- pytest-xdist | |||
- pytest-xvfb |
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.
What does this do on mac/windows?
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.
Nothing. No harm in having it installed (except for storage space). And if xvfb on Linux is not installed, it won't complain either.
Do I have to disable my current X display now? That seems like asking a bit much, but maybe I'm missing a configuration somewhere... pip install pytest-xvfb
pytest lib/matplotlib/tests/test_backend_qt.py produces this error
then I uninstall and the test suite runs again with no error. |
I've only used it out of the box and as I understand, the whole point is that it will detect if xvfb is available and if so start it, if required. If not, it should just go on as normal. No problems on CentOS (without xvfb installed) nor Arch (with xvfb installed). It may be that this is an OSX issue? It seems like pyVirtualDisplay is tested on both 10.15 and 11, but installs xquartz. We are using it on the CI for OSX as well, without installing xquartz. |
https://stackoverflow.com/questions/65890804/xstarterror-in-pyvirtualdisplay (But not so interesting answer...) |
Interesting, it may have been something wrong with an older version of xquartz that I had installed locally. I updated that and now I don't get any errors, but I also don't get the windows being hidden... They still pop up in front of my active window and take priority. This could be because I only have the command |
It is there: https://matplotlib.org/devdocs/devel/dependencies.html#dependencies-for-testing-matplotlib The origin of this PR is that all those are in the environment except for |
(I realize that xarray is also missing, but since I did the PR adding xarray as a test dependency I am not surprised I missed to add it to environment as well...) |
Unfortunately, selectors are not supported in |
There is the pip hack: install pytest-xvfb using a pip section in case of Linux. Should I change to that or just close this PR? |
I think pip (with a comment) is viable. If that's too messy, simply add the condo package but commented out, plus a hint that Linux/win users could activate it. |
I'm confused where this PR is. @timhoffm has approved, but the last comment seems to be asking for a change? |
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 seems to be causing problems on OSX, so should not be added unconditionally. Options are
a) Don't bother with pytest-xvfb here and close the PR
b) Put this in, but commented, plus a note that users on linux/win could activate it if they want
c) Put a pip install here, which supports selectors
I think b) is easiest and put in a suggestion for it.
@@ -56,5 +56,6 @@ dependencies: | |||
- pytest-rerunfailures | |||
- pytest-timeout | |||
- pytest-xdist | |||
- pytest-xvfb |
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.
Probably this is the easiest way forward
- pytest-xvfb | |
# - pytest-xvfb # can be included on linux/win to suppress windows popping up during the test |
I close this. It is maybe a bit inconsistent to not have it in environment, but no harm in skipping it and as it apparently breaks on some Mac installs that seems like the best way. |
PR Summary
In #23231 pytest-xvfb was added as a test dependency, but I missed the development environment. This PR adds it to that.
pytest-xvfb will run the tests using a headless x-server, xvfb, if available, so on Linux machines (maybe OSX?), there will be no windows popping up during tests.
No strictly required for 3.6.0, but I think it would make sense to add it there as well.
PR Checklist
Tests and Styling
pytest
passes).flake8-docstrings
and runflake8 --docstring-convention=all
).Documentation
doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).