[Pytest-commit] Issue #713: AttributeError: ReprFailDoctest instance has no attribute 'reprcrash' with --doctest-modules, --junit-xml and at a failing doctest. (pytest-dev/pytest)

Richard Barrell issues-reply at bitbucket.org
Wed Apr 8 16:56:20 CEST 2015


New issue 713: AttributeError: ReprFailDoctest instance has no attribute 'reprcrash' with --doctest-modules, --junit-xml and at a failing doctest.
https://bitbucket.org/pytest-dev/pytest/issue/713/attributeerror-reprfaildoctest-instance

Richard Barrell:

Reproduction:

in `a/__init__.py`:

```
#!python

def foo():
    """
    >>> 1 + 1
    3
    """
    pass
```

Without --junit-xml:

```
#!text

$ py.test a --doctest-modules
============================= test session starts ==============================
platform linux2 -- Python 2.7.5 -- py-1.4.26 -- pytest-2.7.0
rootdir: /home/RichardB/a, inifile: 
plugins: cov
collected 1 items

a/__init__.py F

=================================== FAILURES ===================================
_______________________________ [doctest] a.foo ________________________________
002     """
003     >>> 1 + 1
Expected:
    3
Got:
    2

/home/RichardB/a/__init__.py:3: DocTestFailure
=========================== 1 failed in 0.01 seconds ===========================
```

And that's fine. However, when I try with --junit-xml:

```
#!text

$ py.test a --doctest-modules --junit-xml=junit.xml
============================= test session starts ==============================
platform linux2 -- Python 2.7.5 -- py-1.4.26 -- pytest-2.7.0
rootdir: /home/RichardB/a, inifile: 
plugins: cov
collected 1 items

a/__init__.py F
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/main.py", line 84, in wrap_session
INTERNALERROR>     doit(config, session)
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/main.py", line 122, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/core.py", line 521, in __call__
INTERNALERROR>     return self._docall(self.methods, kwargs)
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/core.py", line 528, in _docall
INTERNALERROR>     firstresult=self.firstresult).execute()
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/core.py", line 394, in execute
INTERNALERROR>     res = method(*args)
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/main.py", line 142, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/core.py", line 521, in __call__
INTERNALERROR>     return self._docall(self.methods, kwargs)
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/core.py", line 528, in _docall
INTERNALERROR>     firstresult=self.firstresult).execute()
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/core.py", line 393, in execute
INTERNALERROR>     return wrapped_call(method(*args), self.execute)
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/core.py", line 113, in wrapped_call
INTERNALERROR>     return call_outcome.get_result()
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/core.py", line 138, in get_result
INTERNALERROR>     py.builtin._reraise(*ex)
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/core.py", line 123, in __init__
INTERNALERROR>     self.result = func()
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/core.py", line 394, in execute
INTERNALERROR>     res = method(*args)
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/runner.py", line 65, in pytest_runtest_protocol
INTERNALERROR>     runtestprotocol(item, nextitem=nextitem)
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/runner.py", line 75, in runtestprotocol
INTERNALERROR>     reports.append(call_and_report(item, "call", log))
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/runner.py", line 123, in call_and_report
INTERNALERROR>     hook.pytest_runtest_logreport(report=report)
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/core.py", line 521, in __call__
INTERNALERROR>     return self._docall(self.methods, kwargs)
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/core.py", line 528, in _docall
INTERNALERROR>     firstresult=self.firstresult).execute()
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/core.py", line 394, in execute
INTERNALERROR>     res = method(*args)
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/junitxml.py", line 193, in pytest_runtest_logreport
INTERNALERROR>     self.append_failure(report)
INTERNALERROR>   File "/home/RichardB/buildouts/pytest/eggs/pytest-2.7.0-py2.7.egg/_pytest/junitxml.py", line 132, in append_failure
INTERNALERROR>     message = report.longrepr.reprcrash.message
INTERNALERROR> AttributeError: ReprFailDoctest instance has no attribute 'reprcrash'

=========================== 1 failed in 0.02 seconds ===========================
```




More information about the pytest-commit mailing list