-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Improve docs about plugin discovery/loading at startup #7748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- if exists, load ``conftest.py`` and ``test*/conftest.py`` relative | ||
to the directory part of the first test path. After the ``conftest.py`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really how it works?? (The test*/conftest.py
part, and the "first test path" part)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, this was copied from the previous text.
No I don't think that's how it works, I will double check and update the text accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wow, it actually works this way:
pytest/src/_pytest/config/__init__.py
Lines 505 to 513 in d3f47bf
def _try_load_conftest( | |
self, anchor: py.path.local, importmode: Union[str, ImportMode] | |
) -> None: | |
self._getconftestmodules(anchor, importmode) | |
# let's also consider test* subdirs | |
if anchor.check(dir=1): | |
for x in anchor.listdir("test*"): | |
if x.check(dir=1): | |
self._getconftestmodules(x, importmode) |
So that's correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eeek
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I concur... 😬
Co-authored-by: Ran Benita <[email protected]>
Improve docs about plugin discovery/loading at startup (cherry picked from commit f324b27)
Fix #7691