Skip to content

pkgutil.extend_path has no tests #59022

Closed

Description

@ericvsmith
BPO 14817
Nosy @pitrou, @ericvsmith, @Windsooon
PRs
  • gh-59022: add tests to extend_path #12871
  • 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:

    assignee = None
    closed_at = None
    created_at = <Date 2012-05-15.19:19:00.156>
    labels = ['easy', 'type-feature', '3.8', '3.9', '3.7', 'tests']
    title = 'pkgutil.extend_path has no tests'
    updated_at = <Date 2019-07-29.18:36:31.538>
    user = 'https://github.com/ericvsmith'

    bugs.python.org fields:

    activity = <Date 2019-07-29.18:36:31.538>
    actor = 'nanjekyejoannah'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Tests']
    creation = <Date 2012-05-15.19:19:00.156>
    creator = 'eric.smith'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 14817
    keywords = ['patch', 'easy']
    message_count = 10.0
    messages = ['160751', '160784', '160785', '160792', '160809', '221843', '338577', '338934', '339764', '340465']
    nosy_count = 4.0
    nosy_names = ['pitrou', 'eric.smith', 'Arfrever', 'Windson Yang']
    pr_nums = ['12871']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue14817'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9']

    Linked PRs

    Activity

    1. ericvsmith commented on May 15, 2012

      @ericvsmith
      MemberAuthor

      Subject says it all.

      There are also no tests of .pkg files.

    2. python-dev commented on May 16, 2012

      python-devmannequin
      Mannequin

      New changeset 48cb6b67d306 by Eric V. Smith in branch '3.2':
      Issue bpo-14817: Add rudimentary tests for pkgutil.extend_path.
      http://hg.python.org/cpython/rev/48cb6b67d306

    3. ericvsmith commented on May 16, 2012

      @ericvsmith
      MemberAuthor

      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.

    4. ericvsmith commented on May 16, 2012

      @ericvsmith
      MemberAuthor

      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.

    5. pitrou commented on May 16, 2012

      @pitrou
      Member

      This has broken all 3.x buildbots.

    6. BreamoreBoy commented on Jun 29, 2014

      BreamoreBoymannequin
      Mannequin

      @eric will you pick this up again?

    7. Windsooon commented on Mar 22, 2019

      Windsooonmannequin
      Mannequin

      I would like to work on this and make a PR.

    8. Windsooon commented on Mar 27, 2019

      Windsooonmannequin
      Mannequin

      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.

    9. nanjekyejoannah commented on Apr 9, 2019

      @nanjekyejoannah
      Contributor

      @windson please open a PR for review with your code.

    10. 1 remaining item

    11. transferred this issue fromon Apr 10, 2022
    12. added 5 commits that reference this issue on Jul 13, 2024
    13. added a commit that references this issue on Jul 16, 2024
    14. added a commit that references this issue on Jul 16, 2024
    15. added a commit that references this issue on Jul 17, 2024
    16. added 2 commits that reference this issue on Jul 18, 2024
    17. added 2 commits that reference this issue on Jul 19, 2024
    18. encukou commented on Jul 19, 2024

      @encukou
      Member

      Thank you!

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions