diff --git a/src/_pytest/reports.py b/src/_pytest/reports.py index 3f199cb8b..33b906702 100644 --- a/src/_pytest/reports.py +++ b/src/_pytest/reports.py @@ -9,13 +9,15 @@ def getslaveinfoline(node): d = node.slaveinfo ver = "%s.%s.%s" % d["version_info"][:3] node._slaveinfocache = s = "[%s] %s -- Python %s %s" % ( - d["id"], d["sysplatform"], ver, d["executable"] + d["id"], + d["sysplatform"], + ver, + d["executable"], ) return s class BaseReport(object): - def __init__(self, **kw): self.__dict__.update(kw) @@ -149,7 +151,9 @@ class TestReport(BaseReport): def __repr__(self): return "" % ( - self.nodeid, self.when, self.outcome + self.nodeid, + self.when, + self.outcome, ) @@ -164,7 +168,6 @@ class TeardownErrorReport(BaseReport): class CollectReport(BaseReport): - def __init__(self, nodeid, outcome, longrepr, result, sections=(), **extra): self.nodeid = nodeid self.outcome = outcome @@ -179,12 +182,13 @@ class CollectReport(BaseReport): def __repr__(self): return "" % ( - self.nodeid, len(self.result), self.outcome + self.nodeid, + len(self.result), + self.outcome, ) class CollectErrorRepr(TerminalRepr): - def __init__(self, msg): self.longrepr = msg diff --git a/src/_pytest/runner.py b/src/_pytest/runner.py index dea1115e7..5739bbef0 100644 --- a/src/_pytest/runner.py +++ b/src/_pytest/runner.py @@ -257,46 +257,6 @@ def pytest_runtest_makereport(item, call): ) -def pytest_runtest_makereport(item, call): - when = call.when - duration = call.stop - call.start - keywords = {x: 1 for x in item.keywords} - excinfo = call.excinfo - sections = [] - if not call.excinfo: - outcome = "passed" - longrepr = None - else: - if not isinstance(excinfo, ExceptionInfo): - outcome = "failed" - longrepr = excinfo - elif excinfo.errisinstance(skip.Exception): - outcome = "skipped" - r = excinfo._getreprcrash() - longrepr = (str(r.path), r.lineno, r.message) - else: - outcome = "failed" - if call.when == "call": - longrepr = item.repr_failure(excinfo) - else: # exception in setup or teardown - longrepr = item._repr_failure_py( - excinfo, style=item.config.option.tbstyle - ) - for rwhen, key, content in item._report_sections: - sections.append(("Captured %s %s" % (key, rwhen), content)) - return TestReport( - item.nodeid, - item.location, - keywords, - outcome, - longrepr, - when, - sections, - duration, - user_properties=item.user_properties, - ) - - def pytest_make_collect_report(collector): call = CallInfo(lambda: list(collector.collect()), "collect") longrepr = None