config: fallback confcutdir to rootpath if inipath is not set#11043
Merged
bluetech merged 1 commit intopytest-dev:mainfrom May 30, 2023
Merged
config: fallback confcutdir to rootpath if inipath is not set#11043bluetech merged 1 commit intopytest-dev:mainfrom
bluetech merged 1 commit intopytest-dev:mainfrom
Conversation
2765d8b to
1eb1eb4
Compare
nicoddemus
approved these changes
May 30, 2023
changelog/11043.improvement.rst
Outdated
| @@ -0,0 +1,3 @@ | |||
| In cases when `--confcutdir` is not specified, and there is no config file present, the conftest cutoff directory (confcutdir) is now set to the :ref:`rootdir`. | |||
| Previously in such cases, conftest.py files will be probed all the way to the root directory of the filesystem. | |||
Member
There was a problem hiding this comment.
Suggested change
| Previously in such cases, conftest.py files will be probed all the way to the root directory of the filesystem. | |
| Previously in such cases, `conftest.py` files would be probed all the way to the root directory of the filesystem. |
changelog/11043.improvement.rst
Outdated
| @@ -0,0 +1,3 @@ | |||
| In cases when `--confcutdir` is not specified, and there is no config file present, the conftest cutoff directory (confcutdir) is now set to the :ref:`rootdir`. | |||
Member
There was a problem hiding this comment.
Suggested change
| In cases when `--confcutdir` is not specified, and there is no config file present, the conftest cutoff directory (confcutdir) is now set to the :ref:`rootdir`. | |
| In cases when `--confcutdir` is not specified, and there is no config file present, the conftest cutoff directory (`--confcutdir`) is now set to the :ref:`rootdir`. |
| if self.inipath is not None: | ||
| confcutdir = str(self.inipath.parent) | ||
| else: | ||
| confcutdir = str(self.rootpath) |
Member
There was a problem hiding this comment.
It would be good to have a more specific test for this change.
Currently, if `--confcutdir` is not set, `inipath.parent` is used, and if `initpath` is not set, then `confcutdir` is None, which means there is no cutoff. Having no cutoff is not great, it means we potentially start probing stuff all the way up to the filesystem root directory. So let's add another fallback, to `rootpath`, which is always something reasonable.
1eb1eb4 to
4a1bba2
Compare
bluetech
commented
May 30, 2023
Member
Author
bluetech
left a comment
There was a problem hiding this comment.
Thanks for the review @nicoddemus, I applied your suggestions.
| if self.inipath is not None: | ||
| confcutdir = str(self.inipath.parent) | ||
| else: | ||
| confcutdir = str(self.rootpath) |
This was referenced Jun 23, 2023
This was referenced Jun 26, 2023
manu0x0
pushed a commit
to isc-projects/bind9
that referenced
this pull request
Jul 20, 2023
In pytest 7.4.0, there were some changes to how the configuration file for pytest is located. In our case, this resulted in a failure to find the conftest.py with the needed fixtures which then prevented our python tests from being executed successfully. Configure the --confcutdir to ensure it points to the system test directory, where our conftest.py is located. Related pytest-dev/pytest#11043
freebsd-git
pushed a commit
to freebsd/freebsd-src
that referenced
this pull request
Jul 21, 2023
As of pytest 7.4 it no longer walks all the way to the root directory of the file system to find conftest files. As a result we don't find / usr/tests/conftest.py, and don't load atf_python. That in turn causes atf_python tests to fail. Explicitly set the confcutdir, as advised by the pytest changelog. See also: pytest-dev/pytest#11043 MFC after: 3 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D41064
freebsd-git
pushed a commit
to freebsd/freebsd-src
that referenced
this pull request
Aug 4, 2023
As of pytest 7.4 it no longer walks all the way to the root directory of the file system to find conftest files. As a result we don't find / usr/tests/conftest.py, and don't load atf_python. That in turn causes atf_python tests to fail. Explicitly set the confcutdir, as advised by the pytest changelog. See also: pytest-dev/pytest#11043 MFC after: 3 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D41064 (cherry picked from commit 9f23cbd)
bsdjhb
pushed a commit
to bsdjhb/cheribsd
that referenced
this pull request
Sep 6, 2023
As of pytest 7.4 it no longer walks all the way to the root directory of the file system to find conftest files. As a result we don't find / usr/tests/conftest.py, and don't load atf_python. That in turn causes atf_python tests to fail. Explicitly set the confcutdir, as advised by the pytest changelog. See also: pytest-dev/pytest#11043 MFC after: 3 weeks Sponsored by: Orange Business Services Differential Revision: https://reviews.freebsd.org/D41064
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, if
--confcutdiris not set,inipath.parentis used, and ifinitpathis not set, thenconfcutdiris None, which means there is no cutoff.Having no cutoff is not great, it means we potentially start probing stuff all the way up to the filesystem root directory. So let's add another fallback, to
rootpath, which is always something reasonable.