try to consider all modules after registration as plugin
This commit is contained in:
parent
daca618012
commit
8bcf88ec12
|
@ -8,7 +8,8 @@ import warnings
|
||||||
|
|
||||||
import py
|
import py
|
||||||
# DON't import pytest here because it causes import cycle troubles
|
# DON't import pytest here because it causes import cycle troubles
|
||||||
import sys, os
|
import sys
|
||||||
|
import os
|
||||||
import _pytest._code
|
import _pytest._code
|
||||||
import _pytest.hookspec # the extension point definitions
|
import _pytest.hookspec # the extension point definitions
|
||||||
import _pytest.assertion
|
import _pytest.assertion
|
||||||
|
@ -252,6 +253,9 @@ class PytestPluginManager(PluginManager):
|
||||||
if ret:
|
if ret:
|
||||||
self.hook.pytest_plugin_registered.call_historic(
|
self.hook.pytest_plugin_registered.call_historic(
|
||||||
kwargs=dict(plugin=plugin, manager=self))
|
kwargs=dict(plugin=plugin, manager=self))
|
||||||
|
|
||||||
|
if isinstance(plugin, types.ModuleType):
|
||||||
|
self.consider_module(plugin)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def getplugin(self, name):
|
def getplugin(self, name):
|
||||||
|
@ -396,8 +400,7 @@ class PytestPluginManager(PluginManager):
|
||||||
self.import_plugin(arg)
|
self.import_plugin(arg)
|
||||||
|
|
||||||
def consider_conftest(self, conftestmodule):
|
def consider_conftest(self, conftestmodule):
|
||||||
if self.register(conftestmodule, name=conftestmodule.__file__):
|
self.register(conftestmodule, name=conftestmodule.__file__)
|
||||||
self.consider_module(conftestmodule)
|
|
||||||
|
|
||||||
def consider_env(self):
|
def consider_env(self):
|
||||||
self._import_plugin_specs(os.environ.get("PYTEST_PLUGINS"))
|
self._import_plugin_specs(os.environ.get("PYTEST_PLUGINS"))
|
||||||
|
@ -441,7 +444,6 @@ class PytestPluginManager(PluginManager):
|
||||||
else:
|
else:
|
||||||
mod = sys.modules[importspec]
|
mod = sys.modules[importspec]
|
||||||
self.register(mod, modname)
|
self.register(mod, modname)
|
||||||
self.consider_module(mod)
|
|
||||||
|
|
||||||
|
|
||||||
def _get_plugin_specs_as_list(specs):
|
def _get_plugin_specs_as_list(specs):
|
||||||
|
|
Loading…
Reference in New Issue