-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-59022: Added tests for pkgutil.extend_path
(#59022)
#121673
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
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 <[email protected]>
…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 <[email protected]>
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 <[email protected]>
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. |
…H-121951) 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 <[email protected]>
…H-121950) 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 <[email protected]>
This adds tests for the documented behaviour of
pkgutil.extend_path
regarding different argument types as well as for*.pkg
files.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.