diff --git a/_pytest/config.py b/_pytest/config.py index 555799658..e573ec8ab 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -495,7 +495,7 @@ FILE_OR_DIR = 'file_or_dir' class Config(object): """ access to configuration values, pluginmanager and plugin hooks. """ - def __init__(self, pluginmanager=None): + def __init__(self, pluginmanager): #: access to command line option as attributes. #: (deprecated), use :py:func:`getoption() <_pytest.config.Config.getoption>` instead self.option = CmdOptions() @@ -505,7 +505,7 @@ class Config(object): processopt=self._processopt, ) #: a pluginmanager instance - self.pluginmanager = pluginmanager or PluginManager(load=True) + self.pluginmanager = pluginmanager self.trace = self.pluginmanager.trace.root.get("config") self._conftest = Conftest(onimport=self._onimportconftest) self.hook = self.pluginmanager.hook @@ -516,7 +516,7 @@ class Config(object): @classmethod def fromdictargs(cls, option_dict, args): """ constructor useable for subprocesses. """ - config = cls() + config = cls(PluginManager(load=True)) # XXX slightly crude way to initialize capturing import _pytest.capture _pytest.capture.pytest_cmdline_parse(config.pluginmanager, args) diff --git a/testing/test_config.py b/testing/test_config.py index 1e3eb6d70..912ebbe83 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -82,7 +82,7 @@ class TestConfigCmdlineParsing: class TestConfigAPI: def test_config_trace(self, testdir): - config = testdir.Config() + config = testdir.parseconfig() l = [] config.trace.root.setwriter(l.append) config.trace("hello") diff --git a/testing/test_core.py b/testing/test_core.py index 0a18a8efc..8a960228b 100644 --- a/testing/test_core.py +++ b/testing/test_core.py @@ -319,7 +319,7 @@ class TestPytestPluginInteractions: def pytest_myhook(xyz): return xyz + 1 """) - config = testdir.Config() + config = testdir.Config(PluginManager(load=True)) config._conftest.importconftest(conf) print(config.pluginmanager.getplugins()) res = config.hook.pytest_myhook(xyz=10) diff --git a/testing/test_tmpdir.py b/testing/test_tmpdir.py index 164ee68c6..6ec790283 100644 --- a/testing/test_tmpdir.py +++ b/testing/test_tmpdir.py @@ -36,7 +36,7 @@ def test_ensuretemp(recwarn): class TestTempdirHandler: def test_mktemp(self, testdir): - config = testdir.Config() + config = testdir.parseconfig() config.option.basetemp = testdir.mkdir("hello") t = TempdirHandler(config) tmp = t.mktemp("world")