-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Clarify PytestPluginManager._is_in_confcutdir #12007
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
Follow up to pytest-dev#12006, let's put some comments clarifying `is_in_confcutdir` semantics, as this is not the first time someone misunderstands it. Also removed an obsolete comment in `_loadconftestmodules`: we already set the `confcutdir` based on `rootdir`/`initfile` if not explicitly given.
@@ -578,12 +578,18 @@ def _set_initial_conftests( | |||
self._try_load_conftest(invocation_dir, importmode, rootpath) | |||
|
|||
def _is_in_confcutdir(self, path: Path) -> bool: |
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.
How about renaming this to focus on the purpose of the method rather than the implementation detail?
def _is_in_confcutdir(self, path: Path) -> bool: | |
def _should_load_conftests_from(self, path: Path) -> bool: |
@@ -609,9 +615,6 @@ def _loadconftestmodules( | |||
if directory in self._dirpath2confmods: | |||
return | |||
|
|||
# XXX these days we may rather want to use config.rootpath |
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.
This comment is outdated, we always configure confcutdir
nowadays:
pytest/src/_pytest/config/__init__.py
Lines 1334 to 1339 in 40011b8
if self.known_args_namespace.confcutdir is None: | |
if self.inipath is not None: | |
confcutdir = str(self.inipath.parent) | |
else: | |
confcutdir = str(self.rootpath) | |
self.known_args_namespace.confcutdir = confcutdir |
Co-authored-by: Ran Benita <[email protected]>
Follow up to pytest-dev#12006, let's put some comments clarifying `is_in_confcutdir` semantics, as this is not the first time someone misunderstands it. Also removed an obsolete comment in `_loadconftestmodules`: we already set the `confcutdir` based on `rootdir`/`initfile` if not explicitly given. Co-authored-by: Ran Benita <[email protected]>
Follow up to #12006, let's put some comments clarifying
is_in_confcutdir
semantics, as this is not the first time someone misunderstands it.Also removed an obsolete comment in
_loadconftestmodules
: we already set theconfcutdir
based onrootdir
/initfile
if not explicitly given.