From c68a89b4a78a4bd4ab5ab1b139f9fe5b002bdad8 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Mon, 31 Jul 2017 11:10:29 +0200 Subject: [PATCH 1/3] remove preinit, its no longer needed --- _pytest/config.py | 9 --------- changelog/2236.removal | 1 + pytest.py | 3 +-- 3 files changed, 2 insertions(+), 11 deletions(-) create mode 100644 changelog/2236.removal diff --git a/_pytest/config.py b/_pytest/config.py index d0ec62096..bdfe99b99 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -100,8 +100,6 @@ def directory_arg(path, optname): return path -_preinit = [] - default_plugins = ( "mark main terminal runner python fixtures debugging unittest capture skipping " "tmpdir monkeypatch recwarn pastebin helpconfig nose assertion " @@ -113,14 +111,7 @@ builtin_plugins = set(default_plugins) builtin_plugins.add("pytester") -def _preloadplugins(): - assert not _preinit - _preinit.append(get_config()) - - def get_config(): - if _preinit: - return _preinit.pop(0) # subsequent calls to main will create a fresh instance pluginmanager = PytestPluginManager() config = Config(pluginmanager) diff --git a/changelog/2236.removal b/changelog/2236.removal new file mode 100644 index 000000000..013327291 --- /dev/null +++ b/changelog/2236.removal @@ -0,0 +1 @@ +- remove plugin preinit, we no longer need to do that because the namespace is initialized in the module now \ No newline at end of file diff --git a/pytest.py b/pytest.py index 1c914a6ed..2b681b64b 100644 --- a/pytest.py +++ b/pytest.py @@ -7,7 +7,7 @@ pytest: unit and functional testing with Python. # else we are imported from _pytest.config import ( - main, UsageError, _preloadplugins, cmdline, + main, UsageError, cmdline, hookspec, hookimpl ) from _pytest.fixtures import fixture, yield_fixture @@ -74,5 +74,4 @@ if __name__ == '__main__': else: from _pytest.compat import _setup_collect_fakemodule - _preloadplugins() # to populate pytest.* namespace so help(pytest) works _setup_collect_fakemodule() From e90f876b348cb070d4b1a50e1f7f8312c17ee1de Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Mon, 31 Jul 2017 13:48:25 +0200 Subject: [PATCH 2/3] remove the last own implementation of pytest_namespace --- _pytest/main.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/_pytest/main.py b/_pytest/main.py index 4bddf1e2d..ee1ce00a2 100644 --- a/_pytest/main.py +++ b/_pytest/main.py @@ -83,15 +83,6 @@ def pytest_addoption(parser): help="base temporary directory for this test run.") -def pytest_namespace(): - """keeping this one works around a deeper startup issue in pytest - - i tried to find it for a while but the amount of time turned unsustainable, - so i put a hack in to revisit later - """ - return {} - - def pytest_configure(config): __import__('pytest').config = config # compatibiltiy From dcaeef7c10d0df00100367a8c75813e761348c70 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Mon, 31 Jul 2017 22:21:09 +0200 Subject: [PATCH 3/3] take review comments into account --- changelog/2236.removal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog/2236.removal b/changelog/2236.removal index 013327291..84f98d009 100644 --- a/changelog/2236.removal +++ b/changelog/2236.removal @@ -1 +1 @@ -- remove plugin preinit, we no longer need to do that because the namespace is initialized in the module now \ No newline at end of file +- Remove internal ``_preloadplugins()`` function. This removal is part of the ``pytest_namespace()`` hook deprecation. \ No newline at end of file