@@ -6,6 +6,7 @@ |
|
|
6 |
6 |
|
7 |
7 |
import contextlib |
8 |
8 |
import faulthandler |
|
9 |
+import glob |
9 |
10 |
import io |
10 |
11 |
import os.path |
11 |
12 |
import platform |
@@ -529,6 +530,31 @@ def run_python(self, args, **kw): |
|
|
529 |
530 |
return proc.stdout |
530 |
531 |
|
531 |
532 |
|
|
533 |
+class CheckActualTests(BaseTestCase): |
|
534 |
+""" |
|
535 |
+ Check that regrtest appears to find the expected set of tests. |
|
536 |
+ """ |
|
537 |
+ |
|
538 |
+def test_finds_expected_number_of_tests(self): |
|
539 |
+args = ['-Wd', '-E', '-bb', '-m', 'test.regrtest', '--list-tests'] |
|
540 |
+output = self.run_python(args) |
|
541 |
+rough_number_of_tests_found = len(output.splitlines()) |
|
542 |
+actual_testsuite_glob = os.path.join(os.path.dirname(__file__), |
|
543 |
+'test*.py') |
|
544 |
+rough_counted_test_py_files = len(glob.glob(actual_testsuite_glob)) |
|
545 |
+# We're not trying to duplicate test finding logic in here, |
|
546 |
+# just give a rough estimate of how many there should be and |
|
547 |
+# be near that. This is a regression test to prevent mishaps |
|
548 |
+# such as https://bugs.python.org/issue37667 in the future. |
|
549 |
+# If you need to change the values in here during some |
|
550 |
+# mythical future test suite reorganization, don't go |
|
551 |
+# overboard with logic and keep that goal in mind. |
|
552 |
+self.assertGreater(rough_number_of_tests_found, |
|
553 |
+rough_counted_test_py_files*9//10, |
|
554 |
+msg='Unexpectedly low number of tests found in:\n' |
|
555 |
+f'{", ".join(output.splitlines())}') |
|
556 |
+ |
|
557 |
+ |
532 |
558 |
class ProgramsTestCase(BaseTestCase): |
533 |
559 |
""" |
534 |
560 |
Test various ways to run the Python test suite. Use options close |