gh-110164: regrtest disables random if SOURCE_DATE_EPOCH (#110168)

If the SOURCE_DATE_EPOCH environment variable is defined, regrtest
now disables randomization of tests.
This commit is contained in:
Victor Stinner 2023-10-01 22:41:03 +02:00 committed by GitHub
parent adf0f15a06
commit 65c285062c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 2 deletions

View file

@ -148,6 +148,14 @@ class ParseArgsTestCase(unittest.TestCase):
ns = self.parse_args([opt])
self.assertTrue(ns.randomize)
with os_helper.EnvironmentVarGuard() as env:
env['SOURCE_DATE_EPOCH'] = '1'
ns = self.parse_args(['--randomize'])
regrtest = main.Regrtest(ns)
self.assertFalse(regrtest.randomize)
self.assertIsNone(regrtest.random_seed)
def test_randseed(self):
ns = self.parse_args(['--randseed', '12345'])
self.assertEqual(ns.random_seed, 12345)