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.
This commit is contained in:
Florian Dahlitz 2020-05-24 12:53:44 +02:00 committed by GitHub
parent fdc5a94279
commit 905b3cd05f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View 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