summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2020-05-24 11:14:17 (GMT)
committerGitHub <noreply@github.com>2020-05-24 11:14:17 (GMT)
commit874506cff9aff2cb5eb0192c878e08ded18326a9 (patch)
tree1238082fc15a9e8efb79a0e611bd3110eb47a2ae
parenta3c3e8920af292f6c16425efc80aa764e1305f59 (diff)
downloadcpython-874506cff9aff2cb5eb0192c878e08ded18326a9.zip
cpython-874506cff9aff2cb5eb0192c878e08ded18326a9.tar.gz
cpython-874506cff9aff2cb5eb0192c878e08ded18326a9.tar.bz2
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 905b3cd05f8d2c29e1605d109900e3e9d07af4d3) Co-authored-by: Florian Dahlitz <f2dahlitz@freenet.de>
-rw-r--r--Lib/idlelib/NEWS.txt2
-rw-r--r--Lib/idlelib/idle_test/test_autocomplete.py2
-rw-r--r--Misc/NEWS.d/next/IDLE/2020-05-24-06-19-43.bpo-40723.AJLd4U.rst1
3 files changed, 4 insertions, 1 deletions
diff --git a/Lib/idlelib/NEWS.txt b/Lib/idlelib/NEWS.txt
index 46b1523..b112e8e 100644
--- a/Lib/idlelib/NEWS.txt
+++ b/Lib/idlelib/NEWS.txt
@@ -3,6 +3,8 @@ Released on 2020-10-05?
======================================
+bpo-40723: Make test_idle pass when run after import.
+
bpo-38689: IDLE will no longer freeze when inspect.signature fails
when fetching a calltip.
diff --git a/Lib/idlelib/idle_test/test_autocomplete.py b/Lib/idlelib/idle_test/test_autocomplete.py
index 2c478cd..1841495 100644
--- a/Lib/idlelib/idle_test/test_autocomplete.py
+++ b/Lib/idlelib/idle_test/test_autocomplete.py
@@ -227,7 +227,7 @@ class AutoCompleteTest(unittest.TestCase):
acp = self.autocomplete
small, large = acp.fetch_completions(
'', ac.ATTRS)
- if __main__.__file__ != ac.__file__:
+ if hasattr(__main__, '__file__') and __main__.__file__ != ac.__file__:
self.assertNotIn('AutoComplete', small) # See issue 36405.
# Test attributes
diff --git a/Misc/NEWS.d/next/IDLE/2020-05-24-06-19-43.bpo-40723.AJLd4U.rst b/Misc/NEWS.d/next/IDLE/2020-05-24-06-19-43.bpo-40723.AJLd4U.rst
new file mode 100644
index 0000000..e0de2f9
--- /dev/null
+++ b/Misc/NEWS.d/next/IDLE/2020-05-24-06-19-43.bpo-40723.AJLd4U.rst
@@ -0,0 +1 @@
+Make test_idle pass when run after import.