diff --git a/py/test/dist/dsession.py b/py/test/dist/dsession.py index e97ec8e59..06d5ed068 100644 --- a/py/test/dist/dsession.py +++ b/py/test/dist/dsession.py @@ -30,7 +30,7 @@ class LoopState(object): if rep.failed: self.testsfailed = True - def pyevent__collectionreport(self, rep): + def pyevent__collectreport(self, rep): if rep.passed: self.colitems.extend(rep.result) @@ -175,7 +175,7 @@ class DSession(Session): senditems.append(next) else: self.bus.notify("collectionstart", next) - self.queueevent("collectionreport", basic_collect_report(next)) + self.queueevent("collectreport", basic_collect_report(next)) if self.config.option.dist == "each": self.senditems_each(senditems) else: diff --git a/py/test/dist/testing/test_dsession.py b/py/test/dist/testing/test_dsession.py index 010a28447..dc528af07 100644 --- a/py/test/dist/testing/test_dsession.py +++ b/py/test/dist/testing/test_dsession.py @@ -80,7 +80,7 @@ class TestDSession: session = DSession(modcol.config) session.triggertesting([modcol]) name, args, kwargs = session.queue.get(block=False) - assert name == 'collectionreport' + assert name == 'collectreport' rep, = args assert len(rep.result) == 1 @@ -343,7 +343,7 @@ class TestDSession: session.queueevent("itemtestreport", run(item1, node)) # but we have a collection pending - session.queueevent("collectionreport", colreport) + session.queueevent("collectreport", colreport) loopstate = session._initloopstate([]) session.loop_once(loopstate) diff --git a/py/test/looponfail/remote.py b/py/test/looponfail/remote.py index 0353d2ccc..41ac4db97 100644 --- a/py/test/looponfail/remote.py +++ b/py/test/looponfail/remote.py @@ -140,7 +140,7 @@ def slave_runsession(channel, config, fullwidth, hasmarkup): def pyevent__itemtestreport(self, rep): if rep.failed: self.append(rep) - pyevent__collectionreport = pyevent__itemtestreport + pyevent__collectreport = pyevent__itemtestreport failreports = Failures() session.bus.register(failreports) diff --git a/py/test/plugin/api.py b/py/test/plugin/api.py index 6741289f9..5cbf90605 100644 --- a/py/test/plugin/api.py +++ b/py/test/plugin/api.py @@ -100,7 +100,7 @@ class Events: def pyevent__collectionstart(self, collector): """ collector starts collecting. """ - def pyevent__collectionreport(self, rep): + def pyevent__collectreport(self, rep): """ collector finished collecting. """ def pyevent__testrunstart(self): diff --git a/py/test/plugin/pytest_pytester.py b/py/test/plugin/pytest_pytester.py index 784795587..0542a3042 100644 --- a/py/test/plugin/pytest_pytester.py +++ b/py/test/plugin/pytest_pytester.py @@ -327,14 +327,14 @@ class EventRecorder(object): # functionality for test reports - def getreports(self, names="itemtestreport collectionreport"): + def getreports(self, names="itemtestreport collectreport"): names = names.split() l = [] for call in self.getcalls(*names): l.append(call.rep) return l - def matchreport(self, inamepart="", names="itemtestreport collectionreport"): + def matchreport(self, inamepart="", names="itemtestreport collectreport"): """ return a testreport whose dotted import path matches """ l = [] for rep in self.getreports(names=names): @@ -348,7 +348,7 @@ class EventRecorder(object): inamepart, l)) return l[0] - def getfailures(self, names='itemtestreport collectionreport'): + def getfailures(self, names='itemtestreport collectreport'): l = [] for call in self.getcalls(*names.split()): if call.rep.failed: @@ -356,7 +356,7 @@ class EventRecorder(object): return l def getfailedcollections(self): - return self.getfailures('collectionreport') + return self.getfailures('collectreport') def listoutcomes(self): passed = [] @@ -406,7 +406,7 @@ def test_eventrecorder(): rep.skipped = True bus.notify("itemtestreport", rep) - rep = runner.CollectionReport(None, None) + rep = runner.CollectReport(None, None) rep.passed = False rep.failed = True bus.notify("itemtestreport", rep) diff --git a/py/test/plugin/pytest_resultlog.py b/py/test/plugin/pytest_resultlog.py index 2b9684f87..e8fdff4a4 100644 --- a/py/test/plugin/pytest_resultlog.py +++ b/py/test/plugin/pytest_resultlog.py @@ -68,7 +68,7 @@ class ResultLog(object): longrepr = str(rep.longrepr.reprcrash.message) self.log_outcome(rep, code, longrepr) - def pyevent__collectionreport(self, rep): + def pyevent__collectreport(self, rep): if not rep.passed: if rep.failed: code = "F" diff --git a/py/test/plugin/pytest_terminal.py b/py/test/plugin/pytest_terminal.py index a29666124..a476eb803 100644 --- a/py/test/plugin/pytest_terminal.py +++ b/py/test/plugin/pytest_terminal.py @@ -184,7 +184,7 @@ class TerminalReporter: self._tw.write(" " + line) self.currentfspath = -2 - def pyevent__collectionreport(self, rep): + def pyevent__collectreport(self, rep): if not rep.passed: if rep.failed: self.stats.setdefault("failed", []).append(rep) @@ -316,7 +316,7 @@ class CollectonlyReporter: def pyevent__itemstart(self, item, node=None): self.outindent(item) - def pyevent__collectionreport(self, rep): + def pyevent__collectreport(self, rep): if not rep.passed: self.outindent("!!! %s !!!" % rep.longrepr.reprcrash.message) self._failed.append(rep) @@ -603,7 +603,7 @@ class TestTerminal: lineno = 3 message = "justso" - ev1 = runner.CollectionReport(None, None) + ev1 = runner.CollectReport(None, None) ev1.when = "execute" ev1.skipped = True ev1.longrepr = longrepr @@ -637,8 +637,8 @@ class TestCollectonly: linecomp.assert_contains_lines([ " ", ]) - rep.config.bus.notify( "collectionreport", - runner.CollectionReport(modcol, [], excinfo=None)) + rep.config.bus.notify( "collectreport", + runner.CollectReport(modcol, [], excinfo=None)) assert rep.indent == indent def test_collectonly_skipped_module(self, testdir, linecomp): diff --git a/py/test/runner.py b/py/test/runner.py index 0f8bdfbd0..a99183054 100644 --- a/py/test/runner.py +++ b/py/test/runner.py @@ -52,7 +52,7 @@ def basic_collect_report(collector): raise except: excinfo = py.code.ExceptionInfo() - return CollectionReport(collector, res, excinfo, outerr) + return CollectReport(collector, res, excinfo, outerr) from cPickle import Pickler, Unpickler @@ -98,9 +98,7 @@ class BaseReport(object): else: out.line(str(longrepr)) -# XXX rename to runtest() report ? class ItemTestReport(BaseReport): - """ Test Execution Report. """ failed = passed = skipped = False def __init__(self, colitem, excinfo=None, when=None, outerr=None): @@ -139,9 +137,7 @@ class ItemTestReport(BaseReport): self.longrepr = longrepr -# XXX rename to collectreport -class CollectionReport(BaseReport): - """ Collection Report. """ +class CollectReport(BaseReport): skipped = failed = passed = False def __init__(self, colitem, result, excinfo=None, outerr=None): @@ -160,7 +156,6 @@ class CollectionReport(BaseReport): self.failed = True class ItemSetupReport(BaseReport): - """ Test Execution Report. """ failed = passed = skipped = False def __init__(self, item, excinfo=None, outerr=None): self.item = item diff --git a/py/test/session.py b/py/test/session.py index bd685edcb..aab711a45 100644 --- a/py/test/session.py +++ b/py/test/session.py @@ -47,7 +47,7 @@ class Session(object): if rep.passed: for x in self.genitems(rep.result, keywordexpr): yield x - notify("collectionreport", rep) + notify("collectreport", rep) if self.shouldstop: break @@ -86,7 +86,7 @@ class Session(object): self._testsfailed = True if self.config.option.exitfirst: self.shouldstop = True - pyevent__collectionreport = pyevent__itemtestreport + pyevent__collectreport = pyevent__itemtestreport def sessionfinishes(self, exitstatus=0, excinfo=None): """ teardown any resources after a test run. """ diff --git a/py/test/testing/test_collect.py b/py/test/testing/test_collect.py index 1b515e492..55aaed535 100644 --- a/py/test/testing/test_collect.py +++ b/py/test/testing/test_collect.py @@ -167,7 +167,7 @@ class TestCollectPluginHooks: assert "hello" in wascalled assert "world" in wascalled # make sure the directories do not get double-appended - colreports = sorter.getreports(names="collectionreport") + colreports = sorter.getreports(names="collectreport") names = [rep.colitem.name for rep in colreports] assert names.count("hello") == 1 @@ -207,10 +207,10 @@ class TestCustomConftests: """) testdir.mkdir("hello") sorter = testdir.inline_run(testdir.tmpdir) - names = [rep.colitem.name for rep in sorter.getreports("collectionreport")] + names = [rep.colitem.name for rep in sorter.getreports("collectreport")] assert 'hello' not in names evrec = testdir.inline_run(testdir.tmpdir, "--XX") - names = [rep.colitem.name for rep in evrec.getreports("collectionreport")] + names = [rep.colitem.name for rep in evrec.getreports("collectreport")] assert 'hello' in names class TestCollectorReprs: diff --git a/py/test/testing/test_session.py b/py/test/testing/test_session.py index 2d85a13c9..a4775b25a 100644 --- a/py/test/testing/test_session.py +++ b/py/test/testing/test_session.py @@ -130,7 +130,7 @@ class SessionTests: def test_one(): pass """) sorter = testdir.inline_run(testdir.tmpdir) - reports = sorter.getreports("collectionreport") + reports = sorter.getreports("collectreport") assert len(reports) == 1 assert reports[0].skipped @@ -203,7 +203,7 @@ class TestNewSession(SessionTests): assert len(itemstarted) == 3 assert not sorter.getreports("itemtestreport") started = sorter.getcalls("collectionstart") - finished = sorter.getreports("collectionreport") + finished = sorter.getreports("collectreport") assert len(started) == len(finished) assert len(started) == 8 colfail = [x for x in finished if x.failed] @@ -215,7 +215,7 @@ class TestNewSession(SessionTests): testdir.makepyfile(__init__="") testdir.makepyfile(test_one="xxxx", test_two="yyyy") sorter = testdir.inline_run("-x", testdir.tmpdir) - finished = sorter.getreports("collectionreport") + finished = sorter.getreports("collectreport") colfail = [x for x in finished if x.failed] assert len(colfail) == 1