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

IDLE: make autocomplete test run without __main__.__file__ #84900

Closed
terryjreedy opened this issue May 22, 2020 · 10 comments
Closed

IDLE: make autocomplete test run without __main__.__file__ #84900

terryjreedy opened this issue May 22, 2020 · 10 comments
Assignees
Labels
3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes tests Tests in the Lib/test dir topic-IDLE type-bug An unexpected behavior, bug, or error

Comments

@terryjreedy
Copy link
Member

BPO 40723
Nosy @terryjreedy, @miss-islington, @DahlitzFlorian
PRs
  • bpo-40723: Make IDLE autocomplete test run without __main__.__file__ #20311
  • [3.9] bpo-40723: Make IDLE autocomplete test run without __main__.__file__ (GH-20311) #20350
  • [3.8] bpo-40723: Make IDLE autocomplete test run without __main__.__file__ (GH-20311) #20351
  • [3.7] bpo-40723: Make IDLE autocomplete test run without __main__.__file__ (GH-20311) #20352
  • 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/terryjreedy'
    closed_at = None
    created_at = <Date 2020-05-22.04:07:15.782>
    labels = ['type-bug', '3.8', '3.9', '3.10', 'expert-IDLE', '3.7']
    title = 'IDLE: make autocomplete test run without __main__.__file__'
    updated_at = <Date 2020-05-24.11:14:20.819>
    user = 'https://github.com/terryjreedy'

    bugs.python.org fields:

    activity = <Date 2020-05-24.11:14:20.819>
    actor = 'miss-islington'
    assignee = 'terry.reedy'
    closed = False
    closed_date = None
    closer = None
    components = ['IDLE']
    creation = <Date 2020-05-22.04:07:15.782>
    creator = 'terry.reedy'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 40723
    keywords = ['patch']
    message_count = 9.0
    messages = ['369555', '369556', '369564', '369576', '369587', '369781', '369783', '369785', '369786']
    nosy_count = 3.0
    nosy_names = ['terry.reedy', 'miss-islington', 'DahlitzFlorian']
    pr_nums = ['20311', '20350', '20351', '20352']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue40723'
    versions = ['Python 3.7', 'Python 3.8', 'Python 3.9', 'Python 3.10']

    @terryjreedy
    Copy link
    Member Author

    import test.test_idle as ti
    import unittest as u
    u.main(ti)
    has one failure:
    Traceback (most recent call last):
      File "C:\Programs\Python39\lib\idlelib\idle_test\test_autocomplete.py", line 230, in test_fetch_completions
        if __main__.__file__ != ac.__file__:
    AttributeError: module '__main__' has no attribute '__file__'
    ac = autocomplete. The condition is followed by 
                self.assertNotIn('AutoComplete', small)  # See issue 36405

    which is false when ac is run as main to run the test. Adding "hasattr(main, '__file__') and " to the beginning of the condition should be sufficient. I should add a note to bpo-36405 explaining this conditional assertion better.

    @terryjreedy terryjreedy added 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes labels May 22, 2020
    @terryjreedy terryjreedy self-assigned this May 22, 2020
    @terryjreedy terryjreedy added topic-IDLE type-bug An unexpected behavior, bug, or error 3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes labels May 22, 2020
    @terryjreedy terryjreedy self-assigned this May 22, 2020
    @terryjreedy terryjreedy added topic-IDLE type-bug An unexpected behavior, bug, or error labels May 22, 2020
    @terryjreedy
    Copy link
    Member Author

    This is currently the only occurrence of __main__.__file__ in idlelib.

    @DahlitzFlorian
    Copy link
    Mannequin

    DahlitzFlorian mannequin commented May 22, 2020

    I was able to reproduce the reported issue and the suggested fix worked fine. Is there anything else missing like documentation note?

    I would like to submit a PR for this @terry.reedy

    @terryjreedy
    Copy link
    Member Author

    Go ahead. Since the failure was user visible, there should be a note. For IDLE issues, idlelib/NEWS.txt also needs an addition, but not until ready to merge. So add a trial blurb or not as you wish. In any case, I need to fix the 3.8 version and perhaps the 3.7 version before another IDLE commit.

    @DahlitzFlorian
    Copy link
    Mannequin

    DahlitzFlorian mannequin commented May 22, 2020

    I added a news entry to idlelib/NEWS.txt but don't know, where to add an additional note. The documentation of IDLE doesn't seem to be the right place. Should a note be added to Misc/NEWS.d/next or would it be redundant, because it is already added to idlelib/NEWS.txt?

    Sorry, if I misunderstood you, but it is my first contribution to IDLE. Thanks for the guidance, I really appreciate it!

    @terryjreedy
    Copy link
    Member Author

    New changeset 905b3cd by Florian Dahlitz in branch 'master':
    bpo-40723: Make IDLE autocomplete test run without __main__.__file__ (GH-20311)
    905b3cd

    @miss-islington
    Copy link
    Contributor

    New changeset a64df48 by Miss Islington (bot) in branch '3.8':
    bpo-40723: Make IDLE autocomplete test run without __main__.__file__ (GH-20311)
    a64df48

    @miss-islington
    Copy link
    Contributor

    New changeset 82397e2 by Miss Islington (bot) in branch '3.7':
    bpo-40723: Make IDLE autocomplete test run without __main__.__file__ (GH-20311)
    82397e2

    @miss-islington
    Copy link
    Contributor

    New changeset 874506c by Miss Islington (bot) in branch '3.9':
    bpo-40723: Make IDLE autocomplete test run without __main__.__file__ (GH-20311)
    874506c

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @erlend-aasland
    Copy link
    Contributor

    Are there further work to be done here, or can we close this?

    @erlend-aasland erlend-aasland added the tests Tests in the Lib/test dir label Jul 27, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes tests Tests in the Lib/test dir topic-IDLE type-bug An unexpected behavior, bug, or error
    Projects
    Status: Done
    Development

    No branches or pull requests

    3 participants