This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Windson Yang
Recipients Arfrever, Windson Yang, eric.smith, pitrou
Date 2019-03-27.01:55:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1553651731.06.0.485854699573.issue14817@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-03-27 01:55:31Windson Yangsetrecipients: + Windson Yang, pitrou, eric.smith, Arfrever
2019-03-27 01:55:31Windson Yangsetmessageid: <1553651731.06.0.485854699573.issue14817@roundup.psfhosted.org>
2019-03-27 01:55:31Windson Yanglinkissue14817 messages
2019-03-27 01:55:30Windson Yangcreate