-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
SOURCE_DATE_EPOCH: AssertionError: 'Using random seed ([0-9]+)' not found in 'Using random seed None...' #110932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The The The unexpected numbers in I suppose this could all be fixed if the tests invoke subprocess with SOURCE_DATE_EPOCH unset. cpython/Lib/test/test_regrtest.py Lines 758 to 760 in 6a4528d
|
cc @vstinner |
The following naïve patch makes the test pass: $ git diff
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index e65d9a89ff8..5ffbea5d910 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -391,8 +391,12 @@ def check_ci_mode(self, args, use_resources, rerun=True):
regrtest = main.Regrtest(ns)
self.assertEqual(regrtest.num_workers, -1)
self.assertEqual(regrtest.want_rerun, rerun)
- self.assertTrue(regrtest.randomize)
- self.assertIsInstance(regrtest.random_seed, int)
+ if 'SOURCE_DATE_EPOCH' in os.environ:
+ self.assertFalse(regrtest.randomize)
+ self.assertIsNone(regrtest.random_seed)
+ else:
+ self.assertTrue(regrtest.randomize)
+ self.assertIsInstance(regrtest.random_seed, int)
self.assertTrue(regrtest.fail_env_changed)
self.assertTrue(regrtest.print_slowest)
self.assertTrue(regrtest.output_on_failure)
@@ -700,6 +704,11 @@ def run_python(self, args, **kw):
if 'uops' in sys._xoptions:
# Pass -X uops along
extraargs.extend(['-X', 'uops'])
+ # discard SOURCE_DATE_EPOCH
+ # https://github.com/python/cpython/issues/110932
+ kw['env'] = kw.get('env') or dict(os.environ)
+ if 'SOURCE_DATE_EPOCH' in kw['env']:
+ del kw['env']['SOURCE_DATE_EPOCH']
args = [sys.executable, *extraargs, '-X', 'faulthandler', '-I', *args]
proc = self.run_command(args, **kw)
return proc.stdout However, since this is testing regrtest, I suppose a proper fix is to add tests that test the randomness behavior with SOURCE_DATE_EPOCH set and without SOURCE_DATE_EPOCH set, rather than always unsetting it or asserting based on environment. |
If the SOURCE_DATE_EPOCH environment variable is defined, use its value as a string as the random seed.
If the SOURCE_DATE_EPOCH environment variable is defined, use its value as a string as the random seed.
If the SOURCE_DATE_EPOCH environment variable is defined, use its value as a string as the random seed.
If the SOURCE_DATE_EPOCH environment variable is defined, use its value as a string as the random seed.
If the SOURCE_DATE_EPOCH environment variable is defined, use its value as a string as the random seed.
If the SOURCE_DATE_EPOCH environment variable is defined, use its value as the random seed.
If the SOURCE_DATE_EPOCH environment variable is defined, use its value as the random seed.
If the SOURCE_DATE_EPOCH environment variable is defined, use its value as the random seed.
I proposed PR gh-111143 to fix this issue. |
If the SOURCE_DATE_EPOCH environment variable is defined, use its value as the random seed. (cherry picked from commit 7237fb5) Co-authored-by: Victor Stinner <[email protected]>
If the SOURCE_DATE_EPOCH environment variable is defined, use its value as the random seed.
If the SOURCE_DATE_EPOCH environment variable is defined, use its value as the random seed. (cherry picked from commit 7237fb5) Co-authored-by: Victor Stinner <[email protected]>
…1153) gh-110932: Fix regrtest for SOURCE_DATE_EPOCH (GH-111143) If the SOURCE_DATE_EPOCH environment variable is defined, use its value as the random seed. (cherry picked from commit 7237fb5) Co-authored-by: Victor Stinner <[email protected]>
…1154) gh-110932: Fix regrtest for SOURCE_DATE_EPOCH (GH-111143) If the SOURCE_DATE_EPOCH environment variable is defined, use its value as the random seed. (cherry picked from commit 7237fb5) Co-authored-by: Victor Stinner <[email protected]>
If the SOURCE_DATE_EPOCH environment variable is defined, use its value as the random seed.
If the SOURCE_DATE_EPOCH environment variable is defined, use its value as the random seed.
Bug report
Bug description:
After #110168 when the test suite is run with
$SOURCE_DATE_EPOCH
set,test_regrtest
fails.Traceback:
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
The text was updated successfully, but these errors were encountered: