-
-
Notifications
You must be signed in to change notification settings - Fork 71
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
InvocationError when testing via tox but not via pytest called directly #170
Comments
Does adding edit: My best guess would be that |
@The-Compiler thanks a lot for the quick help by the way. This issue has irritated me for months and I only now put in a bit of time to produce a demo to try and get it resolved. |
You'll either need to do that or install pytest-xvfb then. Unfortunately, Qt simply calls There's really not much we can do about this... I wonder if it'd help if pytest-qt disabled the output capturing while creating the |
@ixjlyons perhaps we can add a "Troubleshooting" sections to the docs, where we can mention both the "tox passenv" solution and the "abort()" issue? |
I am facing the same issue with tox. Tried placing passenv = DISPLAY XAUTHORITY under testenv in tox.ini but that did not help. Did your help on fixing this. |
@cauveryguda Is that with pytest? Can you run pytest with |
I have a similar problem. When running it live, your @The-Compiler your suggestion for passenv works. However, if i plan to integrate the test in the backend through jenkins, it fails with no error displayed. |
Like I said above, you need a display server (or something like pytest-xvfb) to be able to run graphical PyQt applications. |
Came across this issue without using QT. This error pops up when you have no tests defined in your Simply running
Running tox with a simple
After defining at least one test function in tests/*.py the error no longer pops up. |
Hi @dvdblk, That's standard pytest behavior: if it cannot find any test files, it will exit with error code 5, not related to pytest-qt at all. |
Qt applications need a display server to run and be tested. tox will not pass necessary environment variables from invocation environment by default. For tests to run, these variables must be passed in tox configuration explicitly. For more information, see pytest-dev/pytest-qt#170 and pytest-dev/pytest-qt#324
I've set up a minimally reproducible example as a repo here. The README explains how I've invoked the test using pytest directly and with tox, and I can't figure out why it doesn't work with tox.
If I've made an obvious error in my tox.ini somewhere, I'd appreciate finding out what to fix. This is the only place in the tox code that prints out the
InvocationError
without any other information except the command in question (what I'm seeing).It should also be noted that I can run pytest-qt's tests with tox just fine. Also, if I comment out the test function's contents and remove the use of the
qtbot
fixture, the test runs fine with tox.The text was updated successfully, but these errors were encountered: