summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorLouie Lu <git@louie.lu>2017-06-16 11:15:28 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2017-06-16 11:15:28 (GMT)
commitb0c58d3c569d1b9060248e665857b5df94817340 (patch)
tree694a6bfe39dd9609ca1282a8f2386019db6ac9c5 /Lib
parent11e97f2f80bf65cc828c127eafc95229df35d403 (diff)
downloadcpython-b0c58d3c569d1b9060248e665857b5df94817340.zip
cpython-b0c58d3c569d1b9060248e665857b5df94817340.tar.gz
cpython-b0c58d3c569d1b9060248e665857b5df94817340.tar.bz2
bpo-30523: Add --list-cases unittest (#2243)
* bpo-30523: Add --list-cases unittest * Addressed haypo's request * Addressed haypo's request
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_regrtest.py18
1 files changed, 17 insertions, 1 deletions
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index c189b4a..5c6154a 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -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