-
-
Notifications
You must be signed in to change notification settings - Fork 32k
pkgutil.extend_path has no tests #59022
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
Comments
Subject says it all. There are also no tests of .pkg files. |
New changeset 48cb6b67d306 by Eric V. Smith in branch '3.2': |
I'm going to leave this open until better tests are added. The one I did add it very simple, but it's good enough for the changes I'm about to make. |
This code does not clean up correctly. It needs to remove the added modules in sys.modules. I'll eventually clean it up, once bpo-14715 is addressed. |
This has broken all 3.x buildbots. |
@eric will you pick this up again? |
I would like to work on this and make a PR. |
My base idea would be some unittests for the function like: class ExtendPathBaseTests(unittest.TestCase):
def test_input_string(self):
path = 'path'
name = 'foo'
self.assertEqual('path', pkgutil.extend_path(path, name))
def test_parent_package_raise_key_error(self):
path = ['path']
# sys.modules['foo'] raise KeyError
name = 'foo.bar'
self.assertEqual(['path'], pkgutil.extend_path(path, name))
def test_parent_package_raise_attr_error(self):
path = ['path']
# datetime module don't have __path__ attr
name = 'datetime.date'
self.assertEqual(['path'], pkgutil.extend_path(path, name)) I would move forward if we agreed. |
@windson please open a PR for review with your code. |
I added some tests in the PR. Actually, there are some tests for extend_path already (see https://github.com/python/cpython/blob/master/Lib/test/test_pkgutil.py#L235). However, I didn't test every line of the code in the extend_path function. |
This adds tests for the documented behaviour of `pkgutil.extend_path` regarding different argument types as well as for `*.pkg` files.
This adds tests for the documented behaviour of `pkgutil.extend_path` regarding different argument types as well as for `*.pkg` files.
This adds tests for the documented behaviour of `pkgutil.extend_path` regarding different argument types as well as for `*.pkg` files.
This adds tests for the documented behaviour of `pkgutil.extend_path` regarding different argument types as well as for `*.pkg` files.
…on only Co-authored-by: Petr Viktorin <[email protected]>
This adds tests for the documented behaviour of `pkgutil.extend_path` regarding different argument types as well as for `*.pkg` files.
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.
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]>
…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]>
Thank you! |
Uh oh!
There was an error while loading. Please reload this page.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
pkgutil.extend_path
(#59022) #121673pkgutil.extend_path
(GH-59022) (GH-121673) #121950pkgutil.extend_path
(GH-59022) (GH-121673) #121951The text was updated successfully, but these errors were encountered: