classification
Title: IDLE: make autocomplete test run without __main__.__file__
Type: behavior Stage: patch review
Components: IDLE Versions: Python 3.10, Python 3.9, Python 3.8, Python 3.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: DahlitzFlorian, miss-islington, terry.reedy
Priority: normal Keywords: patch

Created on 2020-05-22 04:07 by terry.reedy, last changed 2020-05-24 11:14 by miss-islington.

Pull Requests
URL Status Linked Edit
PR 20311 merged DahlitzFlorian, 2020-05-22 08:29
PR 20350 merged miss-islington, 2020-05-24 10:53
PR 20351 merged miss-islington, 2020-05-24 10:54
PR 20352 merged miss-islington, 2020-05-24 10:54
Messages (9)
msg369555 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-22 04:07
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 #36405 explaining this conditional assertion better.
msg369556 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-22 04:09
This is currently the only occurrence of __main__.__file__ in idlelib.
msg369564 - (view) Author: Florian Dahlitz (DahlitzFlorian) * Date: 2020-05-22 08:04
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
msg369576 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-22 09:37
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.
msg369587 - (view) Author: Florian Dahlitz (DahlitzFlorian) * Date: 2020-05-22 10:56
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!
msg369781 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-05-24 10:53
New changeset 905b3cd05f8d2c29e1605d109900e3e9d07af4d3 by Florian Dahlitz in branch 'master':
bpo-40723: Make IDLE autocomplete test run without __main__.__file__ (GH-20311)
https://github.com/python/cpython/commit/905b3cd05f8d2c29e1605d109900e3e9d07af4d3
msg369783 - (view) Author: miss-islington (miss-islington) Date: 2020-05-24 11:08
New changeset a64df485a4c3ebb0caa1d62c02246cd43d0e976e by Miss Islington (bot) in branch '3.8':
bpo-40723: Make IDLE autocomplete test run without __main__.__file__ (GH-20311)
https://github.com/python/cpython/commit/a64df485a4c3ebb0caa1d62c02246cd43d0e976e
msg369785 - (view) Author: miss-islington (miss-islington) Date: 2020-05-24 11:12
New changeset 82397e2d97f89fdf36cb8eaf3b2d7c407456ec78 by Miss Islington (bot) in branch '3.7':
bpo-40723: Make IDLE autocomplete test run without __main__.__file__ (GH-20311)
https://github.com/python/cpython/commit/82397e2d97f89fdf36cb8eaf3b2d7c407456ec78
msg369786 - (view) Author: miss-islington (miss-islington) Date: 2020-05-24 11:14
New changeset 874506cff9aff2cb5eb0192c878e08ded18326a9 by Miss Islington (bot) in branch '3.9':
bpo-40723: Make IDLE autocomplete test run without __main__.__file__ (GH-20311)
https://github.com/python/cpython/commit/874506cff9aff2cb5eb0192c878e08ded18326a9
History
Date User Action Args
2020-05-24 11:14:20miss-islingtonsetmessages: + msg369786
2020-05-24 11:12:15miss-islingtonsetmessages: + msg369785
2020-05-24 11:08:07miss-islingtonsetmessages: + msg369783
2020-05-24 10:54:14miss-islingtonsetpull_requests: + pull_request19615
2020-05-24 10:54:07miss-islingtonsetpull_requests: + pull_request19614
2020-05-24 10:53:59terry.reedysetmessages: + msg369781
2020-05-24 10:53:58miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request19613
2020-05-22 10:56:37DahlitzFloriansetmessages: + msg369587
2020-05-22 09:37:34terry.reedysetmessages: + msg369576
2020-05-22 08:29:28DahlitzFloriansetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request19580
2020-05-22 08:04:28DahlitzFloriansetnosy: + DahlitzFlorian
messages: + msg369564
2020-05-22 04:09:47terry.reedysetmessages: + msg369556
2020-05-22 04:07:15terry.reedycreate