[svn r62292] use prefix "do_" for configure/unconfigure calls to plugins in addition to addoption.

--HG--
branch : trunk
This commit is contained in:
hpk 2009-03-01 14:56:29 +01:00
parent 50acc51ac1
commit 1764555778
8 changed files with 17 additions and 17 deletions

View File

@ -10,10 +10,10 @@ def main(args=None):
args = py.std.sys.argv[1:]
config = py.test.config
config.parse(args)
config.pytestplugins.configure(config)
config.pytestplugins.do_configure(config)
session = config.initsession()
exitstatus = session.main()
config.pytestplugins.unconfigure(config)
config.pytestplugins.do_unconfigure(config)
raise SystemExit(exitstatus)
def warn_about_missing_assertion():

View File

@ -113,7 +113,7 @@ class SlaveNode(object):
self.channel.send((eventname, args, kwargs))
def run(self):
self.config.pytestplugins.configure(self.config)
self.config.pytestplugins.do_configure(self.config)
from py.__.test.dsession.hostmanage import makehostup
channel = self.channel
self.host = host = channel.receive()

View File

@ -26,7 +26,7 @@ def dumpqueue(queue):
class TestDSession:
def test_fixoptions(self, testdir):
config = testdir.parseconfig("--exec=xxx")
config.pytestplugins.configure(config)
config.pytestplugins.do_configure(config)
config.initsession().fixoptions()
assert config.option.numprocesses == 1
config = testdir.parseconfig("--exec=xxx", '-n3')

View File

@ -129,7 +129,7 @@ def slave_runsession(channel, config, fullwidth, hasmarkup):
config.option.usepdb = False
config.option.executable = None
trails = channel.receive()
config.pytestplugins.configure(config)
config.pytestplugins.do_configure(config)
DEBUG("SLAVE: initsession()")
session = config.initsession()
# XXX configure the reporter object's terminal writer more directly

View File

@ -100,7 +100,7 @@ def test_implied_different_sessions(tmpdir):
def x(*args):
config = py.test.config._reparse([tmpdir] + list(args))
try:
config.pytestplugins.configure(config)
config.pytestplugins.do_configure(config)
except ValueError:
return Exception
return getattr(config._sessionclass, '__name__', None)

View File

@ -134,28 +134,28 @@ class TmpTestdir:
def inline_runsession(self, session):
config = session.config
config.pytestplugins.configure(config)
config.pytestplugins.do_configure(config)
sorter = EventRecorder(config.bus)
session.main()
config.pytestplugins.unconfigure(config)
config.pytestplugins.do_unconfigure(config)
return sorter
def inline_run(self, *args):
config = self.parseconfig(*args)
config.pytestplugins.configure(config)
config.pytestplugins.do_configure(config)
session = config.initsession()
sorter = EventRecorder(config.bus)
session.main()
config.pytestplugins.unconfigure(config)
config.pytestplugins.do_unconfigure(config)
return sorter
def inline_run_with_plugins(self, *args):
config = self.parseconfig(*args)
config.pytestplugins.configure(config)
config.pytestplugins.do_configure(config)
session = config.initsession()
sorter = EventRecorder(config.bus)
session.main()
config.pytestplugins.unconfigure(config)
config.pytestplugins.do_unconfigure(config)
return sorter
def config_preparse(self):

View File

@ -85,13 +85,13 @@ class PytestPlugins(object):
self.pyplugins.call_plugin(plugin, "pytest_addoption", parser=self._config._parser)
self.pyplugins.call_plugin(plugin, "pytest_configure", config=self._config)
def configure(self, config):
def do_configure(self, config):
assert not hasattr(self, '_config')
config.bus.register(self)
self._config = config
self.pyplugins.call_each("pytest_configure", config=self._config)
def unconfigure(self, config):
def do_unconfigure(self, config):
config = self._config
del self._config
self.pyplugins.call_each("pytest_unconfigure", config=config)

View File

@ -158,7 +158,7 @@ class TestPytestPluginInteractions:
from py.__.test.config import Config
config = Config()
config.parse([])
config.pytestplugins.configure(config=config)
config.pytestplugins.do_configure(config=config)
assert not hasattr(config.option, 'test123')
p = testdir.makepyfile("""
class ConftestPlugin:
@ -181,7 +181,7 @@ class TestPytestPluginInteractions:
config.bus.register(A())
assert len(l) == 0
config.pytestplugins.configure(config=config)
config.pytestplugins.do_configure(config=config)
assert len(l) == 1
config.bus.register(A()) # this should lead to a configured() plugin
assert len(l) == 2
@ -191,7 +191,7 @@ class TestPytestPluginInteractions:
assert len(events) == 2
assert events == [42,42]
config.pytestplugins.unconfigure(config=config)
config.pytestplugins.do_unconfigure(config=config)
config.bus.register(A())
assert len(l) == 2