Skip to content
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

add test for changed portions after reloading a namespace package #63910

Closed
brettcannon opened this issue Nov 22, 2013 · 10 comments
Closed

add test for changed portions after reloading a namespace package #63910

brettcannon opened this issue Nov 22, 2013 · 10 comments
Assignees
Labels
tests Tests in the Lib/test dir

Comments

@brettcannon
Copy link
Member

BPO 19711
Nosy @brettcannon, @ncoghlan, @ericsnowcurrently
Files
  • issue19711-test-case.diff
  • issue19711-test_namespace_pkgs.diff: Test case making use of test_namespace_pkgs instead of rolling own dynamic generation.
  • 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 = 'https://github.com/ericsnowcurrently'
    closed_at = <Date 2016-05-10.21:34:09.541>
    created_at = <Date 2013-11-22.16:47:07.320>
    labels = ['tests']
    title = 'add test for changed portions after reloading a namespace package'
    updated_at = <Date 2016-05-12.16:37:08.304>
    user = 'https://github.com/brettcannon'

    bugs.python.org fields:

    activity = <Date 2016-05-12.16:37:08.304>
    actor = 'BreamoreBoy'
    assignee = 'eric.snow'
    closed = True
    closed_date = <Date 2016-05-10.21:34:09.541>
    closer = 'eric.snow'
    components = ['Tests']
    creation = <Date 2013-11-22.16:47:07.320>
    creator = 'brett.cannon'
    dependencies = []
    files = ['34658', '34661']
    hgrepos = []
    issue_num = 19711
    keywords = ['patch']
    message_count = 10.0
    messages = ['203805', '215079', '215108', '215142', '215144', '222286', '232568', '236535', '265279', '265280']
    nosy_count = 5.0
    nosy_names = ['brett.cannon', 'ncoghlan', 'Arfrever', 'python-dev', 'eric.snow']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue19711'
    versions = ['Python 3.6']

    @brettcannon
    Copy link
    Member Author

    @brettcannon brettcannon added the tests Tests in the Lib/test dir label Nov 22, 2013
    @ericsnowcurrently
    Copy link
    Member

    A related addition (Lib/test/test_importlib/test_api.py - test_reload_namespace_changed):

    changeset: 86819:88c3a1a3c2ff3c3ab3f2bd77f0d5d5e5c1b37afa
    parent: 86816:13a05ed33cf7
    user: Eric Snow <ericsnowcurrently@gmail.com>
    date: Thu Oct 31 22:22:15 2013 -0600
    summary: Issue bpo-19413: Restore pre-3.3 reload() semantics of re-finding modules.

    @ericsnowcurrently
    Copy link
    Member

    Here's a patch that adds the test. However, the test is failing and my gut's telling me it's a legitimate failure. I'll verify as soon as I have a chance and open a new issue if it is legit (i.e. a regression in 3.4, albeit an unlikely corner case). Thanks for suggesting the test, Nick!

    @ericsnowcurrently
    Copy link
    Member

    Well, the same patch (modulo adjusting to apply cleanly) fails in exactly the same way in 3.3. So either the test isn't right or namespace packages have never supported reload in this way. I'll keep investigating.

    @ericsnowcurrently
    Copy link
    Member

    Regarding this issue, keep in mind that namespace packages have a dynamic __path__ which already updates (effectively) when new portions are added to sys.path. So we just need to make sure that reloading does not break that.

    To that end, here's a much simpler patch (with passing tests) that verifies that PEP-451 did not break anything here.

    @ericsnowcurrently ericsnowcurrently self-assigned this Mar 29, 2014
    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jul 4, 2014

    Latest patch LGTM. Can we have a patch review please as bpo-18864 is dependent on this.

    @brettcannon
    Copy link
    Member Author

    Do we still need this patch, Eric?

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Feb 24, 2015

    To echo Brett's question, do we still need this patch, Eric?

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented May 10, 2016

    New changeset c22ec7a45114 by Eric Snow in branch 'default':
    Fixes bpo-19711: Add tests for reloading namespace packages.
    https://hg.python.org/cpython/rev/c22ec7a45114

    @ericsnowcurrently
    Copy link
    Member

    I've gone ahead and pushed the patch.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    tests Tests in the Lib/test dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants