[svn r63910] removing old mentionings of "bus". docstrings.

--HG--
branch : trunk
This commit is contained in:
hpk 2009-04-09 20:07:05 +02:00
parent fb7ff9a8c2
commit f319a84503
6 changed files with 18 additions and 15 deletions

View File

@ -22,7 +22,9 @@ class Error(Exception):
""" Test Configuration Error. """ """ Test Configuration Error. """
class Config(object): 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 Option = py.compat.optparse.Option # deprecated
Error = Error Error = Error
basetemp = None basetemp = None

View File

@ -3,11 +3,11 @@ import py
from py.__.test.dist.txnode import TXNode from py.__.test.dist.txnode import TXNode
class EventQueue: class EventQueue:
def __init__(self, bus, queue=None): def __init__(self, registry, queue=None):
if queue is None: if queue is None:
queue = py.std.Queue.Queue() queue = py.std.Queue.Queue()
self.queue = queue self.queue = queue
bus.register(self) registry.register(self)
def geteventargs(self, eventname, timeout=2.0): def geteventargs(self, eventname, timeout=2.0):
events = [] events = []

View File

@ -45,6 +45,7 @@ class CallRecorder:
recorder = RecordCalls() recorder = RecordCalls()
self._recorders[apiclass] = recorder self._recorders[apiclass] = recorder
self._comregistry.register(recorder) self._comregistry.register(recorder)
self.api = py._com.PluginAPI(apiclass, registry=self._comregistry)
def finalize(self): def finalize(self):
for recorder in self._recorders.values(): for recorder in self._recorders.values():

View File

@ -73,10 +73,11 @@ class TmpTestdir:
if hasattr(self, '_olddir'): if hasattr(self, '_olddir'):
self._olddir.chdir() self._olddir.chdir()
def geteventrecorder(self, bus): def geteventrecorder(self, registry):
sorter = EventRecorder(bus) sorter = EventRecorder(registry)
sorter.callrecorder = CallRecorder(bus) sorter.callrecorder = CallRecorder(registry)
sorter.callrecorder.start_recording(api.PluginHooks) sorter.callrecorder.start_recording(api.PluginHooks)
sorter.api = sorter.callrecorder.api
self.pyfuncitem.addfinalizer(sorter.callrecorder.finalize) self.pyfuncitem.addfinalizer(sorter.callrecorder.finalize)
return sorter return sorter
@ -361,13 +362,13 @@ class EventRecorder(object):
self.callrecorder.finalize() self.callrecorder.finalize()
def test_eventrecorder(testdir): def test_eventrecorder(testdir):
bus = py._com.Registry() registry = py._com.Registry()
recorder = testdir.geteventrecorder(bus) recorder = testdir.geteventrecorder(registry)
assert not recorder.getfailures() assert not recorder.getfailures()
rep = runner.ItemTestReport(None, None) rep = runner.ItemTestReport(None, None)
rep.passed = False rep.passed = False
rep.failed = True rep.failed = True
bus.call_each("pytest_itemtestreport", rep=rep) recorder.api.pytest_itemtestreport(rep=rep)
failures = recorder.getfailures() failures = recorder.getfailures()
assert failures == [rep] assert failures == [rep]
failures = recorder.getfailures() failures = recorder.getfailures()
@ -376,12 +377,12 @@ def test_eventrecorder(testdir):
rep = runner.ItemTestReport(None, None) rep = runner.ItemTestReport(None, None)
rep.passed = False rep.passed = False
rep.skipped = True rep.skipped = True
bus.call_each("pytest_itemtestreport", rep=rep) recorder.api.pytest_itemtestreport(rep=rep)
rep = runner.CollectReport(None, None) rep = runner.CollectReport(None, None)
rep.passed = False rep.passed = False
rep.failed = True rep.failed = True
bus.call_each("pytest_itemtestreport", rep=rep) recorder.api.pytest_itemtestreport(rep=rep)
passed, skipped, failed = recorder.listoutcomes() passed, skipped, failed = recorder.listoutcomes()
assert not passed and skipped and failed assert not passed and skipped and failed
@ -394,7 +395,7 @@ def test_eventrecorder(testdir):
recorder.unregister() recorder.unregister()
recorder.clear() recorder.clear()
assert not recorder.getfailures() assert not recorder.getfailures()
bus.call_each("pytest_itemtestreport", rep=rep) recorder.api.pytest_itemtestreport(rep=rep)
assert not recorder.getfailures() assert not recorder.getfailures()
class LineComp: class LineComp:

View File

@ -509,7 +509,7 @@ class TestTerminal:
]) ])
def test_tb_option(self, testdir, linecomp): def test_tb_option(self, testdir, linecomp):
# XXX usage of testdir and event bus # XXX usage of testdir
for tbopt in ["long", "short", "no"]: for tbopt in ["long", "short", "no"]:
print 'testing --tb=%s...' % tbopt print 'testing --tb=%s...' % tbopt
modcol = testdir.getmodulecol(""" modcol = testdir.getmodulecol("""
@ -569,7 +569,6 @@ class TestTerminal:
#""", configargs=("--showskipsummary",) + ("-v",)*verbose) #""", configargs=("--showskipsummary",) + ("-v",)*verbose)
rep = TerminalReporter(modcol.config, file=linecomp.stringio) rep = TerminalReporter(modcol.config, file=linecomp.stringio)
modcol.config.pluginmanager.register(rep) modcol.config.pluginmanager.register(rep)
bus = modcol.config.pluginmanager
modcol.config.api.pytest_testrunstart() modcol.config.api.pytest_testrunstart()
try: try:
for item in testdir.genitems([modcol]): for item in testdir.genitems([modcol]):

View File

@ -317,7 +317,7 @@ def test_options_on_small_file_do_not_blow_up(testdir):
['--traceconfig'], ['-v'], ['-v', '-v']): ['--traceconfig'], ['-v'], ['-v', '-v']):
runfiletest(opts + [path]) runfiletest(opts + [path])
def test_default_bus(): def test_default_registry():
assert py.test.config.pluginmanager.comregistry is py._com.comregistry assert py.test.config.pluginmanager.comregistry is py._com.comregistry
@py.test.mark.todo("test for deprecation") @py.test.mark.todo("test for deprecation")