<div dir="ltr">Hi everyone,<div><br></div><div>I'm having some trouble when trying to use some of xdist-defined hooks in a plugin, but I believe this problem is not related to xdist specifically.<br><div><br></div><div>If I redefine a few of `xdist`'s hook functions inside a conftest file, it works fine. Once I move them to an external plugin however, I start getting "found unknown hook" errors.</div><div><br></div><div>Here is an example:</div><div><br></div><div>    # contents of conftest.py</div><div><div>    def pytest_configure_node(node):</div><div>        assert 0, 'configure_node called'</div><div><br></div><div>    # contents of test_foo.py</div><div>    def test_foo(): pass</div></div><div><br></div><div>In a fresh virtual environment with `pytest-xdist` installed:</div><div><br></div><div>    </div><div>    $ py.test -n2</div><div>    <snip traceback></div><div>    INTERNALERROR> AssertionError: configure_node called</div><div></div></div><div><br></div><div>OK, that's what I expected. </div><div><br></div><div>On the other hand, renaming `conftest.py` to `myplugin.py`:</div><div><br></div><div><div>    $ py.test -n2 -p myplugin</div><div><div>        raise PluginValidationError("%s:\n%s" % (name, stringio.getvalue()))</div><div>    _pytest.helpconfig.PluginValidationError: myplugin:</div><div>    found unknown hook: pytest_configure_node</div></div></div><div><br></div><div>(You might have to configure your $PYTHONPATH to the working directory)</div><div><br></div><div>The same happens if I make a plugin using <a href="http://setup.py/setuptools">setup.py/setuptools</a>.</div><div><br></div><div>Am I missing something, or is this a bug?</div><div><br></div><div>Digging at the source a bit I found that plugin registration and hook validation happen one right after the other, which might be a problem because a plugin might depend on hooks that will be registered by other plugins later. </div><div><br></div><div>Cheers,</div><div>Bruno.</div></div>