Skip to content

Commit 81446fd

Browse files
authored
test_gdb: use unittest test discovery (GH-15405)
Replace test.support.run_unittest() with unittest.main() to automatically discover test cases, instead of having an maintaing manually a list which may be incomplete. Remove also an unused variable.
1 parent 767434c commit 81446fd

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

Lib/test/test_gdb.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import unittest
1414

1515
from test import support
16-
from test.support import run_unittest, findfile, python_is_optimized
16+
from test.support import findfile, python_is_optimized
1717

1818
def get_gdb_version():
1919
try:
@@ -348,7 +348,6 @@ def test_strings(self):
348348
def check_repr(text):
349349
try:
350350
text.encode(encoding)
351-
printable = True
352351
except UnicodeEncodeError:
353352
self.assertGdbRepr(text, ascii(text))
354353
else:
@@ -960,18 +959,13 @@ def test_locals_after_up(self):
960959
self.assertMultilineMatches(bt,
961960
r".*\na = 1\nb = 2\nc = 3\n.*")
962961

963-
def test_main():
962+
963+
def setUpModule():
964964
if support.verbose:
965965
print("GDB version %s.%s:" % (gdb_major_version, gdb_minor_version))
966966
for line in gdb_version.splitlines():
967967
print(" " * 4 + line)
968-
run_unittest(PrettyPrintTests,
969-
PyListTests,
970-
StackNavigationTests,
971-
PyBtTests,
972-
PyPrintTests,
973-
PyLocalsTests
974-
)
968+
975969

976970
if __name__ == "__main__":
977-
test_main()
971+
unittest.main()

0 commit comments

Comments
 (0)