Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-155648: Fix IDLE tests that cannot fail (GH-156257)
test_autocomplete.py:241 passes when proper because any([]) is True is true. It would also pass if small only had underscored words because the filter got reversed. Change logic and replace filter with generator expression
using slice instead of startswith. Change line 242 to match.

test_editor.py:236 and test_configdialog.py:55 have empty tests ('pass'); skip them for now.
PR-GH-156260 add real tests.

template.py:25 tests True == True; skip it. With this, the bug scanner should be satisfied while allowing
setUpClass and tearDownClass to run and be verified.

Remove duplicate and confusing fetch_completions call.
(cherry picked from commit ee1da7e)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
  • Loading branch information
terryjreedy authored and miss-islington committed Aug 24, 2026
commit afa50cf75646089818a51389392a87b2c138348a
1 change: 1 addition & 0 deletions Lib/idlelib/idle_test/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def tearDownClass(cls):
cls.root.destroy()
del cls.root

@unittest.skip('Dummy test')
def test_init(self):
self.assertTrue(True)

Expand Down
16 changes: 7 additions & 9 deletions Lib/idlelib/idle_test/test_autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,16 +230,14 @@ def test_fetch_completions(self):
# For file completion, a large list containing all files in the path,
# and a small list containing files that do not start with '.'.
acp = self.autocomplete
small, large = acp.fetch_completions(
'', ac.ATTRS)
if hasattr(__main__, '__file__') and __main__.__file__ != ac.__file__:
self.assertNotIn('AutoComplete', small) # See issue 36405.

# Test attributes
s, b = acp.fetch_completions('', ac.ATTRS)
self.assertLess(len(small), len(large))
self.assertTrue(all(filter(lambda x: x.startswith('_'), s)))
self.assertTrue(any(filter(lambda x: x.startswith('_'), b)))
# Test current module (what='') attributes.
small, large = acp.fetch_completions('', ac.ATTRS)
if hasattr(__main__, '__file__') and __main__.__file__ != ac.__file__:
self.assertNotIn('AutoComplete', small) # See gh-80586.
self.assertLess(len(small), len(large)) # Not equal
self.assertFalse(any(a[:1] == '_' for a in small))
self.assertTrue(any(a[:1] == '_' for a in large))

# Test smalll should respect to __all__.
with patch.dict('__main__.__dict__', {'__all__': ['a', 'b']}):
Expand Down
1 change: 1 addition & 0 deletions Lib/idlelib/idle_test/test_configdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def tearDownModule():
root = dialog = None


@unittest.skip('Empty tests')
class ConfigDialogTest(unittest.TestCase):

def test_deactivate_current_config(self):
Expand Down
1 change: 1 addition & 0 deletions Lib/idlelib/idle_test/test_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ def test_searcher(self):
self.assertEqual(actual_pair, expected_pair)


@unittest.skip('Empty test')
class RMenuTest(unittest.TestCase):

@classmethod
Expand Down
Loading