-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
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
python3Packages.pytest4: deterministic bytecode #72091
Conversation
For reasons that are not clear to me, the pytest4 check phase produces a lot of non-deterministic bytecode files. This PR turns off bytecode generation and disables a test that force enables bytecode generation.
@FRidh opinions? |
rm testing/test_argcomplete.py | ||
# determinism - this test writes non deterministic bytecode | ||
rm -rf testing/test_assertrewrite.py |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's I think because it uses _write_pyc_fp()
which is pytest
's own internal testing function for writing bytecode.
# determinism - this test writes non deterministic bytecode | ||
rm -rf testing/test_assertrewrite.py | ||
PYTHONDONTWRITEBYTECODE=1 $out/bin/py.test -x testing/ -k "not test_collect_pyargs_with_testpaths" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of files have indeed been rewritten with this bad bytecode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we add PYTHONDONTWRITEBYTECODE=1
to the pytestCheckHook @FRidh ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe. It can happen in case pytest
is simply used. A better solution is probably for it to adhere to SOURCE_DATE_EPOCH
, but there's probably a reason why this custom function exists.
@GrahamcOfBorg build python3Packages.pytest4 |
@GrahamcOfBorg build python3Packages.pytest_4 |
Motivation for this change
For reasons that are not clear to me, the pytest4 check phase produces a lot of non-deterministic bytecode files. This PR turns off bytecode generation during test execution and additionally disables a test that force enables bytecode generation.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)Notify maintainers
cc @domenkozar @lovek323 @madjar @lsix