Skip to content
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

junitxml: incorrect tagging of import errors #575

Closed
pytestbot opened this issue Sep 1, 2014 · 5 comments
Closed

junitxml: incorrect tagging of import errors #575

pytestbot opened this issue Sep 1, 2014 · 5 comments
Labels
type: bug problem that needs to be addressed

Comments

@pytestbot
Copy link
Contributor

Originally reported by: Oleg Sinyavskiy (BitBucket: otognan, GitHub: otognan)


Hello,

There are two kinds of failures you can get running py.test - "failure" and "error".
When you have import errors, it supposed to be an "error" instead of "failure.
However junit xml is inconsistent distinguishing those.
I ran py.test on my suite and I've got 2 import errors and 2 pep8 failures. Here is a junit xml header:

#!xml

<testsuite errors="2" failures="2" name="pytest" skips="0" tests="174" time="4.716">

However import error files are still tagged as "failures" instead of "errors":

#!xml

<testcase classname="" name="test_battery_web_plugin" time="0">
<failure message="collection failure">
btest_battery_web_plugin.py:30: in <module> from battery_web_plugin import BatteryWebService battery_web_plugin.py:24: in <module> import abap E ImportError: No module named abap
</failure>
</testcase>

This bug shows up itself during parsing with https://pypi.python.org/pypi/xunitparser.
It has an assert:

#!python

assert len(tr.errors) == int(root.attrib['errors'])

which check if header summary is consistent with parsed tests descriptions.


@pytestbot
Copy link
Contributor Author

Original comment by Oleg Sinyavskiy (BitBucket: otognan, GitHub: otognan):


Also, if you ignore this assert on errors, xunitparser failes in the next assert because number of tests in the header is kind of wrong: there are 174 tests, but there are 176 elements in the xml (174 successes and failures) + 2 failures that are supposed to be errors.
But its not clear whether its a pytest or xunitparser bug.

@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


Merged in nicoddemus/pytest (pull request #203)

fix issue575: xunit-xml reporting collection errors as failures

@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


fix issue575: xunit-xml reporting collection errors as failures

@pytestbot
Copy link
Contributor Author

Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42):


Merged in nicoddemus/pytest (pull request #203)

fix issue575: xunit-xml reporting collection errors as failures

@pytestbot
Copy link
Contributor Author

Original comment by Oleg Sinyavskiy (BitBucket: otognan, GitHub: otognan):


Thank you guys!

@pytestbot pytestbot added the type: bug problem that needs to be addressed label Jun 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed
Projects
None yet
Development

No branches or pull requests

1 participant