|
8 | 8 |
|
9 | 9 | import py
|
10 | 10 | # DON't import pytest here because it causes import cycle troubles
|
11 |
| -import sys, os |
| 11 | +import sys |
| 12 | +import os |
12 | 13 | import _pytest._code
|
13 | 14 | import _pytest.hookspec # the extension point definitions
|
14 | 15 | import _pytest.assertion
|
@@ -252,6 +253,9 @@ def register(self, plugin, name=None):
|
252 | 253 | if ret:
|
253 | 254 | self.hook.pytest_plugin_registered.call_historic(
|
254 | 255 | kwargs=dict(plugin=plugin, manager=self))
|
| 256 | + |
| 257 | + if isinstance(plugin, types.ModuleType): |
| 258 | + self.consider_module(plugin) |
255 | 259 | return ret
|
256 | 260 |
|
257 | 261 | def getplugin(self, name):
|
@@ -396,8 +400,7 @@ def consider_pluginarg(self, arg):
|
396 | 400 | self.import_plugin(arg)
|
397 | 401 |
|
398 | 402 | def consider_conftest(self, conftestmodule):
|
399 |
| - if self.register(conftestmodule, name=conftestmodule.__file__): |
400 |
| - self.consider_module(conftestmodule) |
| 403 | + self.register(conftestmodule, name=conftestmodule.__file__) |
401 | 404 |
|
402 | 405 | def consider_env(self):
|
403 | 406 | self._import_plugin_specs(os.environ.get("PYTEST_PLUGINS"))
|
@@ -441,7 +444,6 @@ def import_plugin(self, modname):
|
441 | 444 | else:
|
442 | 445 | mod = sys.modules[importspec]
|
443 | 446 | self.register(mod, modname)
|
444 |
| - self.consider_module(mod) |
445 | 447 |
|
446 | 448 |
|
447 | 449 | def _get_plugin_specs_as_list(specs):
|
|
0 commit comments