Skip to content

gh-110332: Remove mentions of random.WichmannHill from test_zlib #110334

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

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions Lib/test/test_zlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,18 +512,7 @@ def test_odd_flush(self):

# Try 17K of data
# generate random data stream
try:
# In 2.3 and later, WichmannHill is the RNG of the bug report
gen = random.WichmannHill()
except AttributeError:
try:
# 2.2 called it Random
gen = random.Random()
except AttributeError:
# others might simply have a single RNG
gen = random
gen.seed(1)
data = gen.randbytes(17 * 1024)
data = random.randbytes(17 * 1024)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of generating random bytes at each run, would it make sense to install Python 2.3, generate these 17 KiB, save them in a file, and use the file in this test?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will take about 500 lines for hex-encoded or base64-encoded data (more if use the bytes literal). Generating 17KB of random data takes less than 0.0001 sec.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vstinner I've recently checked that it is not possible to install anything below python3.7 on m2 #110013 (comment)


# compress, sync-flush, and decompress
first = co.compress(data)
Expand Down