Skip to content

Commit

Permalink
hopefully fix test_evil_prng_registration_nonsense, for real
Browse files Browse the repository at this point in the history
  • Loading branch information
tybug committed Dec 24, 2024
1 parent 7692eb4 commit 23f1fae
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion hypothesis-python/tests/cover/test_random_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ def test_find_does_not_pollute_state():
"ignore:It looks like `register_random` was passed an object that could be garbage collected"
)
def test_evil_prng_registration_nonsense():
gc_collect()
# my guess is that other tests may register randoms that are then marked for
# deletion (but not actually gc'd yet). Therefore, depending on the order tests
# are run, RANDOMS_TO_MANAGE may start with more entries than after a gc. To
# force a clean slate for this test, unconditionally gc.
gc.collect()
# The first test to call deterministic_PRNG registers a new random instance.
# If that's this test, it will throw off our n_registered count in the middle.
# start with a no-op to ensure this registration has occurred.
Expand Down

0 comments on commit 23f1fae

Please # to comment.