gh-59022: Added tests for pkgutil.extend_path (#59022)#121673
gh-59022: Added tests for pkgutil.extend_path (#59022)#121673encukou merged 2 commits intopython:mainfrom
pkgutil.extend_path (#59022)#121673Conversation
c6c232c to
8fb5f1c
Compare
| self.assertEqual(extended_paths[-2], 'baz') | ||
| self.assertEqual(extended_paths[-1], '/foo/bar/baz') |
There was a problem hiding this comment.
Please also
- check that
extended_paths[:-2]is the same as the original path - test that duplicates are removed.
The documentation doesn't make it clear that comments are ignored. Could you note that in the docs?
Perhaps change:
apart from checking for duplicates, all entries ...
to:
blank lines, comments and duplicates are ignored; all other entries ...
There was a problem hiding this comment.
Turns out that extend_path does happily insert duplicates in the list. To not introduce a potentially breaking change, I've adjusted the documentation accordingly. Also, the suggested check that extended_paths[:-2] equals the original path has been added.
8fb5f1c to
c2ddc1d
Compare
This adds tests for the documented behaviour of `pkgutil.extend_path` regarding different argument types as well as for `*.pkg` files.
c2ddc1d to
982a647
Compare
|
Thanks! Just one more issue :) For the future: please avoid force-pushing to CPython PRs; it makes them harder to review. Just add additional commits. The PR will be squashed when it's merged. |
…on only Co-authored-by: Petr Viktorin <encukou@gmail.com>
Thanks for the hint. I will not use force-push for future CPython PRs. Also, the comment in the test is removed now, so this PR is ready to be reviewed again. |
|
Thank you! |
|
Thanks @beachmachine for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
|
Thanks @beachmachine for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
pythonGH-121673) This adds tests for the documented behaviour of `pkgutil.extend_path` regarding different argument types as well as for `*.pkg` files. (cherry picked from commit 8f25321) Co-authored-by: Andreas Stocker <andreas@stocker.co.it>
…ythonGH-121673) This adds tests for the documented behaviour of `pkgutil.extend_path` regarding different argument types as well as for `*.pkg` files.
|
Thanks @beachmachine for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
|
Thanks @beachmachine for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
pythonGH-121673) This adds tests for the documented behaviour of `pkgutil.extend_path` regarding different argument types as well as for `*.pkg` files. (cherry picked from commit 8f25321) Co-authored-by: Andreas Stocker <andreas@stocker.co.it>
pythonGH-121673) This adds tests for the documented behaviour of `pkgutil.extend_path` regarding different argument types as well as for `*.pkg` files. (cherry picked from commit 8f25321) Co-authored-by: Andreas Stocker <andreas@stocker.co.it>
|
GH-121950 is a backport of this pull request to the 3.12 branch. |
|
GH-121951 is a backport of this pull request to the 3.13 branch. |
This adds tests for the documented behaviour of
pkgutil.extend_pathregarding different argument types as well as for*.pkgfiles.I took inspiration from the PR #12871 for the tests I've added. However, some of those tests did not seem to make sense to me, so I've ended up with the two test-cases in this PR.