Issue 14817: pkgutil.extend_path has no tests (original) (raw)

Created on 2012-05-15 19:19 by eric.smith, last changed 2022-04-11 14:57 by admin.

Pull Requests
URL Status Linked Edit
PR 12871 open Windson Yang,2019-04-18 03:14
Messages (10)
msg160751 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2012-05-15 19:19
Subject says it all. There are also no tests of .pkg files.
msg160784 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-05-16 00:46
New changeset 48cb6b67d306 by Eric V. Smith in branch '3.2': Issue #14817: Add rudimentary tests for pkgutil.extend_path. http://hg.python.org/cpython/rev/48cb6b67d306
msg160785 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2012-05-16 00:48
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.
msg160792 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2012-05-16 01:43
This code does not clean up correctly. It needs to remove the added modules in sys.modules. I'll eventually clean it up, once issue 14715 is addressed.
msg160809 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2012-05-16 07:54
This has broken all 3.x buildbots.
msg221843 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-29 13:34
@Eric will you pick this up again?
msg338577 - (view) Author: Windson Yang (Windson Yang) * Date: 2019-03-22 02:00
I would like to work on this and make a PR.
msg338934 - (view) Author: Windson Yang (Windson Yang) * Date: 2019-03-27 01:55
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.
msg339764 - (view) Author: Joannah Nanjekye (nanjekyejoannah) * (Python committer) Date: 2019-04-09 15:26
@Windson please open a PR for review with your code.
msg340465 - (view) Author: Windson Yang (Windson Yang) * Date: 2019-04-18 03:16
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.
History
Date User Action Args
2022-04-11 14:57:30 admin set github: 59022
2019-07-29 18:36:31 nanjekyejoannah set nosy: - nanjekyejoannah
2019-04-18 03:16:13 Windson Yang set messages: +
2019-04-18 03:14:51 Windson Yang set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest12795>
2019-04-09 15:26:31 nanjekyejoannah set nosy: + nanjekyejoannahmessages: +
2019-03-27 01:55:31 Windson Yang set messages: +
2019-03-22 02:00:16 Windson Yang set versions: + Python 3.7, Python 3.8, Python 3.9nosy: + Windson Yangmessages: + type: enhancement
2019-03-16 00:05:34 BreamoreBoy set nosy: - BreamoreBoy
2014-06-29 13:34:39 BreamoreBoy set nosy: + BreamoreBoymessages: +
2012-05-17 16:22:30 Arfrever set nosy: + Arfrever
2012-05-16 07:54:26 pitrou set nosy: + pitroumessages: +
2012-05-16 01:43:21 eric.smith set messages: +
2012-05-16 00:48:05 eric.smith set nosy: - python-devmessages: +
2012-05-16 00:46:18 python-dev set nosy: + python-devmessages: +
2012-05-15 19:19:00 eric.smith create