Skip to content

Commit 874506c

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 a3c3e89 commit 874506c

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

Lib/idlelib/NEWS.txt

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ Released on 2020-10-05?
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

+1-1
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
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)