]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40723: Make IDLE autocomplete test run without __main__.__file__ (GH-20311)
authorFlorian Dahlitz <f2dahlitz@freenet.de>
Sun, 24 May 2020 10:53:44 +0000 (12:53 +0200)
committerGitHub <noreply@github.com>
Sun, 24 May 2020 10:53:44 +0000 (06:53 -0400)
This was the only failure running unittest.main(test.test_idle) after imports.

Lib/idlelib/NEWS.txt
Lib/idlelib/idle_test/test_autocomplete.py
Misc/NEWS.d/next/IDLE/2020-05-24-06-19-43.bpo-40723.AJLd4U.rst [new file with mode: 0644]

index 46b15234a19c63c04314c224726bbf63bd6d0d6e..b112e8ea293a99f0ef44eea2fa5c51b689264013 100644 (file)
@@ -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.
 
index 2c478cd5c2a14664cf3d728e6ae76ff555408660..1841495fcf1a0c69480784cf135e5cde6fdb2876 100644 (file)
@@ -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 (file)
index 0000000..e0de2f9
--- /dev/null
@@ -0,0 +1 @@
+Make test_idle pass when run after import.