Skip to content

Commit a64df48

Browse files
bpo-40723: Make IDLE autocomplete test run without __main__.__file__ (GH-20311)
This was the only failure running unittest.main(test.test_idle) after imports. (cherry picked from commit 905b3cd) Co-authored-by: Florian Dahlitz <[email protected]>
1 parent 2fecb48 commit a64df48

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

Lib/idlelib/NEWS.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ Released on 2019-12-16?
33
======================================
44

55

6+
bpo-40723: Make test_idle pass when run after import.
7+
68
bpo-38689: IDLE will no longer freeze when inspect.signature fails
79
when fetching a calltip.
810

Lib/idlelib/idle_test/test_autocomplete.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def test_fetch_completions(self):
227227
acp = self.autocomplete
228228
small, large = acp.fetch_completions(
229229
'', ac.ATTRS)
230-
if __main__.__file__ != ac.__file__:
230+
if hasattr(__main__, '__file__') and __main__.__file__ != ac.__file__:
231231
self.assertNotIn('AutoComplete', small) # See issue 36405.
232232

233233
# Test attributes
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Make test_idle pass when run after import.

0 commit comments

Comments
 (0)