-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
pytest silently stops importing plugins on ImportError #1479
Comments
Your Workaround has a bug, it Registers Plugins even on exceptions, thus registering the last value under New name |
Moving the Register part into the else part of the previous try should fix it |
That's what I meant with "but maybe this was just a consequence of ignoring the exception and continuing to run the loop" - I was debugging this via IRC with @craftyguy as I couldn't reproduce it on my local machine first, so it was cumbersome enough already 😉 That explains the second traceback, but not why the first was silently ignored. |
@The-Compiler did you manage to find a reproducible example? |
So it seems to do what I expected with a local plugin loaded via
However when doing the same thing in a setuptools entry point, I only get a pytest warning:
This should really be a hard error, IMHO - it's really easy to miss, especially when you're trying to figure out why the hell your commandline arguments aren't accepted and pytest doesn't even run 😉
from setuptools import setup
setup(
name="pytest-issue1479",
packages = ['plugin'],
# the following makes a plugin available to pytest
entry_points = {
'pytest11': [
'issue1479 = plugin.plugin',
]
},
)
import blah |
Hi! |
BTW,
|
If you're talking about commercial work, have you considered getting a support contract with Merlinux? 😉
I don't think so, other than fixing the real underlying issue. The issue here is simply that there's no proper error displayed when a plugin fails to import something.
Blame the Seems allure-framework/allure-python#92 is open already. |
Proposed fix in #1564. |
seeing this issue again on |
@utkjad I can't reproduce:
with:
Do you have a reproducer? Can you show the full output you get? |
Wait - you say "If I revert pytest back to 3.2.5 the test suite runs fine." but this issue is about pytest hiding a traceback. It sounds like you're seeing an entirely different issue. |
I'm also seeing this problem again on a Windows system where a dependency is missing. However, it is not pytest that's eating the exception here, but pluggy (which eats
Since this is an issue in pluggy, I've created a separate issue to further track this: pytest-dev/pluggy#174 |
Yesterday @craftyguy was trying to contribute something to qutebrowser, and we spent the time debugging an interesting pytest/pluggy issue instead 😆
When he tried to run pytest (
tox -e py35-cov
with this tox.ini), he got errors about missing arguments (added in my pytest.ini):Looking at
--version
output, only a subset of the plugins was loaded:However discovering them wasn't the issue:
We then patched pytest's
pluggy.py
like so:(printing the discovered entrypoints, printing the entrypoint name inside the for-loop, and showing all exceptions)
This finally showed us what was going wrong:
pytest-qt
failed to import due to some C++ ABI mismatch, but some outer layer swallowed the exception and didn't report anything at all!Also, I noticed this part which is very confusing:
ValueError: Plugin already registered: pytest-qt=<module 'pytest_travis_fold' from ...>
- but maybe this was just a consequence of ignoring the exception and continuing to run the loop.The text was updated successfully, but these errors were encountered: