diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2023-10-04 06:42:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-04 06:42:12 (GMT) |
commit | 1465386720cd532a378a5cc1e6de9d96dd8fcc81 (patch) | |
tree | 61d4d7d937ff5e1671983096b572dc5cbd1b2f09 /Lib/test/test_regrtest.py | |
parent | 5b9a3fd6a0ce3c347463e6192a59c15f5fcb0043 (diff) | |
download | cpython-1465386720cd532a378a5cc1e6de9d96dd8fcc81.zip cpython-1465386720cd532a378a5cc1e6de9d96dd8fcc81.tar.gz cpython-1465386720cd532a378a5cc1e6de9d96dd8fcc81.tar.bz2 |
gh-110171: `libregrtest` always sets `random.seed` (#110172)
Diffstat (limited to 'Lib/test/test_regrtest.py')
-rw-r--r-- | Lib/test/test_regrtest.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py index 3807134..ba23b36 100644 --- a/Lib/test/test_regrtest.py +++ b/Lib/test/test_regrtest.py @@ -392,7 +392,7 @@ class ParseArgsTestCase(unittest.TestCase): self.assertEqual(regrtest.num_workers, -1) self.assertEqual(regrtest.want_rerun, rerun) self.assertTrue(regrtest.randomize) - self.assertIsNone(regrtest.random_seed) + self.assertIsInstance(regrtest.random_seed, int) self.assertTrue(regrtest.fail_env_changed) self.assertTrue(regrtest.fail_rerun) self.assertTrue(regrtest.print_slowest) @@ -663,7 +663,7 @@ class BaseTestCase(unittest.TestCase): def parse_random_seed(self, output): match = self.regex_search(r'Using random seed ([0-9]+)', output) randseed = int(match.group(1)) - self.assertTrue(0 <= randseed <= 100_000_000, randseed) + self.assertTrue(0 <= randseed, randseed) return randseed def run_command(self, args, input=None, exitcode=0, **kw): @@ -950,6 +950,10 @@ class ArgsTestCase(BaseTestCase): test_random2 = int(match.group(1)) self.assertEqual(test_random2, test_random) + # check that random.seed is used by default + output = self.run_tests(test, exitcode=EXITCODE_NO_TESTS_RAN) + self.assertIsInstance(self.parse_random_seed(output), int) + def test_fromfile(self): # test --fromfile tests = [self.create_test() for index in range(5)] |