Skip to content

AttributeError: ReprFailDoctest instance has no attribute 'reprcrash' with --doctest-modules, --junit-xml and at a failing doctest. #713

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

Closed
pytestbot opened this issue Apr 8, 2015 · 2 comments
Labels
type: bug problem that needs to be addressed

Comments

@pytestbot
Copy link
Contributor

Originally reported by: Richard Barrell (BitBucket: rbarrell, GitHub: rbarrell)


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 ===========================

@pytestbot pytestbot added the type: bug problem that needs to be addressed label Jun 15, 2015
@RichardBarrell
Copy link

pytestbot has the wrong Github username for me. I'm actually RichardBarrell on github. :)

@tuxlife
Copy link

tuxlife commented Jun 16, 2015

we have the same Issue with Python 3 and the current pytest version

» py.test sevenseconds/aws.py --doctest-modules
====================== test session starts ======================
platform linux -- Python 3.4.0 -- py-1.4.28 -- pytest-2.7.1
rootdir: /home/matthias/GIT/stups/sevenseconds, inifile: 
collected 1 items 

sevenseconds/aws.py F

=========================== FAILURES ============================
__________ [doctest] sevenseconds.aws.calculate_subnet __________
060     '''
061     >>> calculate_subnet(IPNetwork('10.0.0.0/16'), 'dmz', 0)
062     IPNetwork('10.0.0.0/21')
063 
064     >>> calculate_subnet(IPNetwork('10.0.0.0/16'), 'internal', 0)
065     IPNetwork('10.0.128.0/20')
066 
067     >>> calculate_subnet(IPNetwork('10.0.0.0/19'), 'dmz', 0)
Expected:
    IPNetwork('10.0.0.0/24')
Got:
    IPNetwork('10.0.0.0/21')

/home/matthias/GIT/stups/sevenseconds/sevenseconds/aws.py:67: DocTestFailure
=================== 1 failed in 0.28 seconds ====================
» py.test sevenseconds/aws.py --doctest-modules --junit-xml=junit.xml
====================== test session starts ======================
platform linux -- Python 3.4.0 -- py-1.4.28 -- pytest-2.7.1
rootdir: /home/matthias/GIT/stups/sevenseconds, inifile: 
collected 1 items 

sevenseconds/aws.py F
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/main.py", line 84, in wrap_session
INTERNALERROR>     doit(config, session)
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/main.py", line 122, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/core.py", line 521, in __call__
INTERNALERROR>     return self._docall(self.methods, kwargs)
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/core.py", line 528, in _docall
INTERNALERROR>     firstresult=self.firstresult).execute()
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/core.py", line 394, in execute
INTERNALERROR>     res = method(*args)
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/main.py", line 142, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/core.py", line 521, in __call__
INTERNALERROR>     return self._docall(self.methods, kwargs)
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/core.py", line 528, in _docall
INTERNALERROR>     firstresult=self.firstresult).execute()
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/core.py", line 393, in execute
INTERNALERROR>     return wrapped_call(method(*args), self.execute)
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/core.py", line 113, in wrapped_call
INTERNALERROR>     return call_outcome.get_result()
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/core.py", line 137, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/core.py", line 123, in __init__
INTERNALERROR>     self.result = func()
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/core.py", line 394, in execute
INTERNALERROR>     res = method(*args)
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/runner.py", line 65, in pytest_runtest_protocol
INTERNALERROR>     runtestprotocol(item, nextitem=nextitem)
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/runner.py", line 75, in runtestprotocol
INTERNALERROR>     reports.append(call_and_report(item, "call", log))
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/runner.py", line 123, in call_and_report
INTERNALERROR>     hook.pytest_runtest_logreport(report=report)
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/core.py", line 521, in __call__
INTERNALERROR>     return self._docall(self.methods, kwargs)
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/core.py", line 528, in _docall
INTERNALERROR>     firstresult=self.firstresult).execute()
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/core.py", line 394, in execute
INTERNALERROR>     res = method(*args)
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/junitxml.py", line 180, in pytest_runtest_logreport
INTERNALERROR>     self.append_failure(report)
INTERNALERROR>   File "/usr/local/lib/python3.4/dist-packages/_pytest/junitxml.py", line 129, in append_failure
INTERNALERROR>     message = report.longrepr.reprcrash.message
INTERNALERROR> AttributeError: 'ReprFailDoctest' object has no attribute 'reprcrash'

=================== 1 failed in 0.25 seconds ====================

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

3 participants