Closed
Description
Consider:
# content of plugin.py
class Hooks:
def pytest_my_hook(self, config):
pass
def pytest_configure(config):
config.pluginmanager.add_hookspec(Hooks)
# content of conftest.py
pytest_plugins = ['plugin']
def pytest_my_hook(self, config):
pass
# content of test_foo.py
def test():
pass
This produces this error:
pytest test_foo.py
Traceback (most recent call last):
File "E:\Miniconda\envs\pytest\Scripts\pytest-script.py", line 9, in <module>
load_entry_point('pytest==3.0.0.dev1', 'console_scripts', 'pytest')()
File "c:\users\bruno\pytest\_pytest\config.py", line 56, in main
config.pluginmanager.check_pending()
File "c:\users\bruno\pytest\_pytest\vendored_packages\pluggy.py", line 490, in check_pending
(name, hookimpl.plugin))
_pytest.vendored_packages.pluggy.PluginValidationError: unknown hook 'pytest_my_hook' in plugin <module 'conftest' from 'C:\Users\bruno\pytest\tmp\conftest.py'>
It seems pytest is validating hooks before actually processing all hooks.
This is using the features
branch just pre-release of 3.0 (be9356a).