Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3652e21f3b | ||
|
|
a84b106a3b | ||
|
|
5d757f9db3 | ||
|
|
674c623ffa | ||
|
|
1fca8ee16d | ||
|
|
185595f596 | ||
|
|
55bc8c49d6 | ||
|
|
530c9b234a | ||
|
|
1ca9eff35d | ||
|
|
5320d25e47 | ||
|
|
96ad4d1cfd | ||
|
|
5c1a35fee4 | ||
|
|
665b8eda8d |
@@ -1,6 +1,21 @@
|
||||
pytest-xdist 1.18.1 (2017-07-05)
|
||||
================================
|
||||
|
||||
Bug Fixes
|
||||
---------
|
||||
|
||||
- Fixed serialization of ``longrepr.sections`` during error reporting from
|
||||
workers. (`#171 <https://github.com/pytest-dev/pytest-xdist/issues/171>`_)
|
||||
|
||||
- Fix ``ReprLocal`` not being unserialized breaking --showlocals usages. (`#176
|
||||
<https://github.com/pytest-dev/pytest-xdist/issues/176>`_)
|
||||
|
||||
|
||||
pytest-xdist 1.18.0 (2017-06-26)
|
||||
================================
|
||||
|
||||
- ``pytest-xdist`` now requires ``pytest>=3.0.0``.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
|
||||
{% endif %}
|
||||
{% if sections[section] %}
|
||||
{% for category, val in definitions.items() if category in sections[section] and category != 'trivial' %}
|
||||
{% for category, val in definitions.items() if category in sections[section] %}
|
||||
|
||||
{{ definitions[category]['name'] }}
|
||||
{{ underline * definitions[category]['name']|length }}
|
||||
|
||||
{% if definitions[category]['showcontent'] %}
|
||||
{% for text, values in sections[section][category]|dictsort(by='value') %}
|
||||
- {{ text }}{% if category != 'vendor' %} ({{ values|sort|join(', ') }}){% endif %}
|
||||
- {{ text }}{% if category != 'vendor' %} (`{{ values[0] }} <https://github.com/pytest-dev/pytest-xdist/issues/{{ values[0][1:] }}>`_){% endif %}
|
||||
|
||||
|
||||
{% endfor %}
|
||||
|
||||
@@ -86,12 +86,54 @@ class TestReportSerialization:
|
||||
""")
|
||||
reports = reprec.getreports("pytest_runtest_logreport")
|
||||
assert len(reports) == 3
|
||||
initial_failure_report = reports[1]
|
||||
d = serialize_report(initial_failure_report)
|
||||
rep = reports[1]
|
||||
added_section = ('Failure Metadata', str("metadata metadata"), "*")
|
||||
rep.longrepr.sections.append(added_section)
|
||||
d = serialize_report(rep)
|
||||
check_marshallable(d)
|
||||
processed_report = unserialize_report("testreport", d)
|
||||
assert 'Expected Message' \
|
||||
in processed_report.longrepr.reprcrash.message
|
||||
a = unserialize_report("testreport", d)
|
||||
# Check assembled == rep
|
||||
assert a.__dict__.keys() == rep.__dict__.keys()
|
||||
for key in rep.__dict__.keys():
|
||||
if key != 'longrepr':
|
||||
assert getattr(a, key) == getattr(rep, key)
|
||||
assert rep.longrepr.reprcrash.lineno == a.longrepr.reprcrash.lineno
|
||||
assert rep.longrepr.reprcrash.message == a.longrepr.reprcrash.message
|
||||
assert rep.longrepr.reprcrash.path == a.longrepr.reprcrash.path
|
||||
assert rep.longrepr.reprtraceback.entrysep \
|
||||
== a.longrepr.reprtraceback.entrysep
|
||||
assert rep.longrepr.reprtraceback.extraline \
|
||||
== a.longrepr.reprtraceback.extraline
|
||||
assert rep.longrepr.reprtraceback.style \
|
||||
== a.longrepr.reprtraceback.style
|
||||
assert rep.longrepr.sections == a.longrepr.sections
|
||||
assert rep.longrepr.reprtraceback.reprentries \
|
||||
== a.longrepr.reprtraceback.reprentries
|
||||
# Missing section attribute PR171
|
||||
assert added_section in a.longrepr.sections
|
||||
|
||||
def test_reprentries_serialization_170(self, testdir):
|
||||
reprec = testdir.inline_runsource("""
|
||||
def test_fail():
|
||||
x = 0
|
||||
assert x
|
||||
""", '--showlocals', '-n1')
|
||||
reports = reprec.getreports("pytest_runtest_logreport")
|
||||
assert len(reports) == 3
|
||||
rep = reports[1]
|
||||
d = serialize_report(rep)
|
||||
a = unserialize_report("testreport", d)
|
||||
|
||||
rep_entries = rep.longrepr.reprtraceback.reprentries
|
||||
a_entries = a.longrepr.reprtraceback.reprentries
|
||||
assert rep_entries == a_entries
|
||||
for i in range(len(a_entries)):
|
||||
assert rep_entries[i].lines == a_entries[i].lines
|
||||
assert rep_entries[i].localssep == a_entries[i].localssep
|
||||
assert rep_entries[i].reprfileloc == a_entries[i].reprfileloc
|
||||
assert rep_entries[i].reprfuncargs == a_entries[i].reprfuncargs
|
||||
assert rep_entries[i].reprlocals == a_entries[i].reprlocals
|
||||
assert rep_entries[i].style == a_entries[i].style
|
||||
|
||||
def test_itemreport_outcomes(self, testdir):
|
||||
reprec = testdir.inline_runsource("""
|
||||
|
||||
@@ -114,7 +114,8 @@ def serialize_report(rep):
|
||||
|
||||
return {
|
||||
'reprcrash': reprcrash,
|
||||
'reprtraceback': reprtraceback
|
||||
'reprtraceback': reprtraceback,
|
||||
'sections': rep.longrepr.sections
|
||||
}
|
||||
|
||||
import py
|
||||
|
||||
@@ -329,10 +329,11 @@ class SlaveController(object):
|
||||
def unserialize_report(name, reportdict):
|
||||
def assembled_report(reportdict):
|
||||
from _pytest._code.code import (
|
||||
ReprEntry,
|
||||
ReprExceptionInfo,
|
||||
ReprFileLocation,
|
||||
ReprEntry,
|
||||
ReprFuncArgs,
|
||||
ReprLocals,
|
||||
ReprTraceback
|
||||
)
|
||||
if reportdict['longrepr']:
|
||||
@@ -343,26 +344,32 @@ def unserialize_report(name, reportdict):
|
||||
|
||||
unserialized_entries = []
|
||||
for entry in reprtraceback['reprentries']:
|
||||
reprfuncargs, reprfileloc = None, None
|
||||
reprfuncargs, reprfileloc, reprlocals = None, None, None
|
||||
if entry['reprfuncargs']:
|
||||
reprfuncargs = ReprFuncArgs(**entry['reprfuncargs'])
|
||||
if entry['reprfileloc']:
|
||||
reprfileloc = ReprFileLocation(**entry['reprfileloc'])
|
||||
if entry['reprlocals']:
|
||||
reprlocals = ReprLocals(entry['reprlocals']['lines'])
|
||||
|
||||
reprentry = ReprEntry(
|
||||
lines=entry['lines'],
|
||||
reprfuncargs=reprfuncargs,
|
||||
reprlocals=entry['reprlocals'],
|
||||
reprlocals=reprlocals,
|
||||
filelocrepr=reprfileloc,
|
||||
style=entry['style']
|
||||
)
|
||||
unserialized_entries.append(reprentry)
|
||||
reprtraceback['reprentries'] = unserialized_entries
|
||||
|
||||
reportdict['longrepr'] = ReprExceptionInfo(
|
||||
exception_info = ReprExceptionInfo(
|
||||
reprtraceback=ReprTraceback(**reprtraceback),
|
||||
reprcrash=ReprFileLocation(**reprcrash),
|
||||
)
|
||||
|
||||
for section in reportdict['longrepr']['sections']:
|
||||
exception_info.addsection(*section)
|
||||
reportdict['longrepr'] = exception_info
|
||||
return reportdict
|
||||
|
||||
if name == "testreport":
|
||||
|
||||
Reference in New Issue
Block a user