fix issue99 - internalerror with --resultlog now produce better output.
the fix depends on another change in the py lib which unifies the output for native and non-native traceback formatting styles
This commit is contained in:
parent
af0edf0d10
commit
a94a6b4282
|
@ -1,6 +1,11 @@
|
|||
Changes between 2.2.0 and 2.2.1.dev
|
||||
----------------------------------------
|
||||
|
||||
- fix issue99 (in pytest and py) internallerrors with resultlog now
|
||||
produce better output - fixed by normalizing pytest_internalerror
|
||||
input arguments.
|
||||
- fix traceback issues (in pytest and py) improve traceback output
|
||||
in conjunction with jinja2 and cython which hack tracebacks
|
||||
- fix issue93 (in pytest and pytest-xdist) avoid "delayed teardowns":
|
||||
the final test in a test node will now run its teardown directly
|
||||
instead of waiting for the end of the session. Thanks Dave Hunt for
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#
|
||||
__version__ = '2.2.1.dev2'
|
||||
__version__ = '2.2.1.dev3'
|
||||
|
|
|
@ -91,5 +91,8 @@ class ResultLog(object):
|
|||
self.log_outcome(report, code, longrepr)
|
||||
|
||||
def pytest_internalerror(self, excrepr):
|
||||
path = excrepr.reprcrash.path
|
||||
reprcrash = getattr(excrepr, 'reprcrash', None)
|
||||
path = getattr(reprcrash, "path", None)
|
||||
if path is None:
|
||||
path = "cwd:%s" % py.path.local()
|
||||
self.write_log_entry(path, '!', str(excrepr))
|
||||
|
|
6
setup.py
6
setup.py
|
@ -24,7 +24,7 @@ def main():
|
|||
name='pytest',
|
||||
description='py.test: simple powerful testing with Python',
|
||||
long_description = long_description,
|
||||
version='2.2.1.dev2',
|
||||
version='2.2.1.dev3',
|
||||
url='http://pytest.org',
|
||||
license='MIT license',
|
||||
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
|
||||
|
@ -32,7 +32,7 @@ def main():
|
|||
author_email='holger at merlinux.eu',
|
||||
entry_points= make_entry_points(),
|
||||
# the following should be enabled for release
|
||||
install_requires=['py>=1.4.5'],
|
||||
install_requires=['py>=1.4.6.dev4'],
|
||||
classifiers=['Development Status :: 6 - Mature',
|
||||
'Intended Audience :: Developers',
|
||||
'License :: OSI Approved :: MIT License',
|
||||
|
@ -70,4 +70,4 @@ def make_entry_points():
|
|||
return {'console_scripts': l}
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main()
|
||||
|
|
|
@ -133,23 +133,26 @@ class TestWithFunctionIntegration:
|
|||
assert lines[14].startswith('X ')
|
||||
assert len(lines) == 15
|
||||
|
||||
def test_internal_exception(self):
|
||||
@pytest.mark.parametrize("style", ("native", "long", "short"))
|
||||
def test_internal_exception(self, style):
|
||||
# they are produced for example by a teardown failing
|
||||
# at the end of the run
|
||||
# at the end of the run or a failing hook invocation
|
||||
try:
|
||||
raise ValueError
|
||||
except ValueError:
|
||||
excinfo = py.code.ExceptionInfo()
|
||||
reslog = ResultLog(None, py.io.TextIO())
|
||||
reslog.pytest_internalerror(excinfo.getrepr())
|
||||
reslog.pytest_internalerror(excinfo.getrepr(style=style))
|
||||
entry = reslog.logfile.getvalue()
|
||||
entry_lines = entry.splitlines()
|
||||
|
||||
assert entry_lines[0].startswith('! ')
|
||||
assert os.path.basename(__file__)[:-9] in entry_lines[0] #.pyc/class
|
||||
if style != "native":
|
||||
assert os.path.basename(__file__)[:-9] in entry_lines[0] #.pyc/class
|
||||
assert entry_lines[-1][0] == ' '
|
||||
assert 'ValueError' in entry
|
||||
|
||||
|
||||
def test_generic(testdir, LineMatcher):
|
||||
testdir.plugins.append("resultlog")
|
||||
testdir.makepyfile("""
|
||||
|
|
Loading…
Reference in New Issue