I believe that there is a bug in the conftest cache in the Session object. In some situations, conftests are applied based on the last one imported, rather than directory hierarchy. The pytest hook docs say "Session and test running activities will invoke all hooks defined in conftest.py files closer to the root of the filesystem." (pytest docs <http://pytest.org/2.2.4/plugins.html#conftest-py-local-per-directory-plugins> ).
I've specifically had problems with creating a new hook, and with the pytest_ignore_collect hook, as I reported here: https://github.com/pytest-dev/pytest/issues/2016. I notice that if I disable the cache (https://github.com/pytest-dev /pytest/blob/master/_pytest/main.py#L568), both of these hooks will operate only on subdirectories, as I would have expected. Another option would be to clear the session's cache each time a new conftest is added (here: https://github.com/pytest-dev/pytest/blob/master/_pytest/config.py#L342), but I am worried about that approach because I know that pytest-xdist has its own session object. Is this the intended behavior? Or does this sound like a real bug? Thanks- Dan W.
_______________________________________________ pytest-dev mailing list [email protected] https://mail.python.org/mailman/listinfo/pytest-dev
