diff --git a/py/test/config.py b/py/test/config.py index eb56d32ca..d34385312 100644 --- a/py/test/config.py +++ b/py/test/config.py @@ -22,7 +22,9 @@ class Error(Exception): """ Test Configuration Error. """ class Config(object): - """ central bus for dealing with configuration/initialization data. """ + """ test configuration object, provides access to config valueso, + the pluginmanager and plugin api. + """ Option = py.compat.optparse.Option # deprecated Error = Error basetemp = None diff --git a/py/test/dist/testing/test_txnode.py b/py/test/dist/testing/test_txnode.py index bf2c09099..63540c52d 100644 --- a/py/test/dist/testing/test_txnode.py +++ b/py/test/dist/testing/test_txnode.py @@ -3,11 +3,11 @@ import py from py.__.test.dist.txnode import TXNode class EventQueue: - def __init__(self, bus, queue=None): + def __init__(self, registry, queue=None): if queue is None: queue = py.std.Queue.Queue() self.queue = queue - bus.register(self) + registry.register(self) def geteventargs(self, eventname, timeout=2.0): events = [] diff --git a/py/test/plugin/pytest__pytest.py b/py/test/plugin/pytest__pytest.py index 424fa9411..ed0e1d582 100644 --- a/py/test/plugin/pytest__pytest.py +++ b/py/test/plugin/pytest__pytest.py @@ -45,6 +45,7 @@ class CallRecorder: recorder = RecordCalls() self._recorders[apiclass] = recorder self._comregistry.register(recorder) + self.api = py._com.PluginAPI(apiclass, registry=self._comregistry) def finalize(self): for recorder in self._recorders.values(): diff --git a/py/test/plugin/pytest_pytester.py b/py/test/plugin/pytest_pytester.py index c81407eaa..0a1d33bad 100644 --- a/py/test/plugin/pytest_pytester.py +++ b/py/test/plugin/pytest_pytester.py @@ -73,10 +73,11 @@ class TmpTestdir: if hasattr(self, '_olddir'): self._olddir.chdir() - def geteventrecorder(self, bus): - sorter = EventRecorder(bus) - sorter.callrecorder = CallRecorder(bus) + def geteventrecorder(self, registry): + sorter = EventRecorder(registry) + sorter.callrecorder = CallRecorder(registry) sorter.callrecorder.start_recording(api.PluginHooks) + sorter.api = sorter.callrecorder.api self.pyfuncitem.addfinalizer(sorter.callrecorder.finalize) return sorter @@ -361,13 +362,13 @@ class EventRecorder(object): self.callrecorder.finalize() def test_eventrecorder(testdir): - bus = py._com.Registry() - recorder = testdir.geteventrecorder(bus) + registry = py._com.Registry() + recorder = testdir.geteventrecorder(registry) assert not recorder.getfailures() rep = runner.ItemTestReport(None, None) rep.passed = False rep.failed = True - bus.call_each("pytest_itemtestreport", rep=rep) + recorder.api.pytest_itemtestreport(rep=rep) failures = recorder.getfailures() assert failures == [rep] failures = recorder.getfailures() @@ -376,12 +377,12 @@ def test_eventrecorder(testdir): rep = runner.ItemTestReport(None, None) rep.passed = False rep.skipped = True - bus.call_each("pytest_itemtestreport", rep=rep) + recorder.api.pytest_itemtestreport(rep=rep) rep = runner.CollectReport(None, None) rep.passed = False rep.failed = True - bus.call_each("pytest_itemtestreport", rep=rep) + recorder.api.pytest_itemtestreport(rep=rep) passed, skipped, failed = recorder.listoutcomes() assert not passed and skipped and failed @@ -394,7 +395,7 @@ def test_eventrecorder(testdir): recorder.unregister() recorder.clear() assert not recorder.getfailures() - bus.call_each("pytest_itemtestreport", rep=rep) + recorder.api.pytest_itemtestreport(rep=rep) assert not recorder.getfailures() class LineComp: diff --git a/py/test/plugin/pytest_terminal.py b/py/test/plugin/pytest_terminal.py index 198d3cdfe..4c74cb724 100644 --- a/py/test/plugin/pytest_terminal.py +++ b/py/test/plugin/pytest_terminal.py @@ -509,7 +509,7 @@ class TestTerminal: ]) def test_tb_option(self, testdir, linecomp): - # XXX usage of testdir and event bus + # XXX usage of testdir for tbopt in ["long", "short", "no"]: print 'testing --tb=%s...' % tbopt modcol = testdir.getmodulecol(""" @@ -569,7 +569,6 @@ class TestTerminal: #""", configargs=("--showskipsummary",) + ("-v",)*verbose) rep = TerminalReporter(modcol.config, file=linecomp.stringio) modcol.config.pluginmanager.register(rep) - bus = modcol.config.pluginmanager modcol.config.api.pytest_testrunstart() try: for item in testdir.genitems([modcol]): diff --git a/py/test/testing/test_config.py b/py/test/testing/test_config.py index 7f60dc961..1ea78feed 100644 --- a/py/test/testing/test_config.py +++ b/py/test/testing/test_config.py @@ -317,7 +317,7 @@ def test_options_on_small_file_do_not_blow_up(testdir): ['--traceconfig'], ['-v'], ['-v', '-v']): runfiletest(opts + [path]) -def test_default_bus(): +def test_default_registry(): assert py.test.config.pluginmanager.comregistry is py._com.comregistry @py.test.mark.todo("test for deprecation")