question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

InvocationError when testing via tox but not via pytest called directly

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
The-Compilercommented, May 11, 2017

Does adding passenv = * under [testenv] change anything? Can you install the pytest-faulthandler plugin and run pytest with -s and see if that gives you anything useful?

edit: My best guess would be that passenv = DISPLAY fixes this

3reactions
The-Compilercommented, May 12, 2017

You’ll either need to do that or install pytest-xvfb then.

Unfortunately, Qt simply calls abort() on that error, and pytest’s output capturing can’t show the error to you as the process was just killed.

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 QApplication though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tox InvocationError (exited with code 1) when running pytest
Is it an expected behavior that pytest failure will cause tox command (wrap around the pytest) exited with code 1? Appreciate your insights....
Read more >
General tips and tricks — tox 3.4.0 documentation
When a command (defined by commands = in tox.ini ) fails, it has a non-zero exit code, and an InvocationError exception is raised...
Read more >
Troubleshooting — pytest-qt documentation - Read the Docs
tox : InvocationError without further information¶ ... pytest-qt needs a DISPLAY to run, otherwise Qt calls abort() and the process crashes immediately. One ......
Read more >
tox 3.0.0rc2 - PyPI
tox displays exit code together with InvocationError - by @blueyed and @ederag. ... using the py Python launcher on Windows and the environment...
Read more >
Top 5 tox Code Examples - Snyk
Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately. Enable here. github ansible /...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found