[Pytest-commit] Issue #575: junitxml: incorrect tagging of import errors (hpk42/pytest)

Oleg Sinyavskiy issues-reply at bitbucket.org
Mon Sep 1 00:37:02 CEST 2014


New issue 575: junitxml: incorrect tagging of import errors
https://bitbucket.org/hpk42/pytest/issue/575/junitxml-incorrect-tagging-of-import

Oleg Sinyavskiy:

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.





More information about the pytest-commit mailing list