Commit b0c58d3c authored by Louie Lu's avatar Louie Lu Committed by Victor Stinner

bpo-30523: Add --list-cases unittest (#2243)

* bpo-30523: Add --list-cases unittest

* Addressed haypo's request

* Addressed haypo's request
parent 11e97f2f
......@@ -825,6 +825,23 @@ class ArgsTestCase(BaseTestCase):
self.assertEqual(output.rstrip().splitlines(),
tests)
def test_list_cases(self):
# test --list-cases
code = textwrap.dedent("""
import unittest
class Tests(unittest.TestCase):
def test_method1(self):
pass
def test_method2(self):
pass
""")
testname = self.create_test(code=code)
all_methods = ['%s.Tests.test_method1' % testname,
'%s.Tests.test_method2' % testname]
output = self.run_tests('--list-cases', testname)
self.assertEqual(output.splitlines(), all_methods)
def test_crashed(self):
# Any code which causes a crash
code = 'import faulthandler; faulthandler._sigsegv()'
......@@ -841,7 +858,6 @@ class ArgsTestCase(BaseTestCase):
return [match.group(1) for match in regex.finditer(output)]
def test_matchfile(self):
# Any code which causes a crash
code = textwrap.dedent("""
import unittest
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment