Repository navigation
[FIX] Use cross-platform os.urandom in test key generation - #1265
Open
rushil23shah-hue wants to merge 1 commit into
Open
rushil23shah-hue wants to merge 1 commit into
rushil23shah-hue wants to merge 1 commit into
Conversation
rushil23shah-hue
requested review from
canihavesomecoffee and
thealphadollar
as code owners
November 8, 2026 10:51
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



In raising this pull request, I confirm the following (please check boxes):
My familiarity with the project is as follows (check one):
Summary
generate_keys()intests/base.pyusedos.system("head -c 24 /dev/urandom > ...")to createsecret_csrfandsecret_keyfiles.On Windows development environments (and any environment lacking
/dev/urandomorhead), this shell command fails silently, causing test initialization to raise:Changes
tests/base.py(generate_keys): Replaced the shell-basedhead -c 24 /dev/urandomcalls with Python's standardos.urandom(24), making test key generation cross-platform across Windows, Linux, and macOS without spawning shell subprocesses.tests/base.py(generate_keys): Ensuredparse.pycreation uses an explicit context manager rather than leaving an open file descriptor.Testing & Verification
secret_key,secret_csrf, andparse.pyand ran tests from a clean state. Verified that all three files are generated automatically.nose2(tests.test_config_parser,tests.test_utility,tests.test_log_configuration); all 12 tests passed cleanly.pycodestyle tests/base.py --config=./.pycodestylercpydocstyle tests/base.py --config=./.pydocstylercisort tests/base.py --check-only