1/ RFC: I just released a rough cut of pytest-caprng. It captures the state of your random number generator before each test; saves it on failure; and, replays it *exactly* on the next run. If you write randomized algos or simulations, you'll like this.https://github.com/jbn/pytest-caprng …
-
Show this thread
-
Replying to @generativist
I'm sure this will be valuable for many, but the right approach is to *never* rely on global RNG state. You should always be creating isolated random.Random() or np.random.RandomState() objects, which obviates the need for these save/restore state gymnastics.
1 reply 1 retweet 3 likes -
Replying to @shoyer
That's nice in theory, but I find it rarely works in practice. Passing around instantiated RNGs becomes to tedious. E.G. How often do you see scipy.stats dists rvs() sampled with the optional rng param?
2 replies 0 retweets 0 likes -
Replying to @generativist @shoyer
(Although, that does seed an idea for an excellent extension. For those that do are passing around states, a fixture that injects an instantiated RNG which gets cached on failure rather than the global alone is useful!)
1 reply 0 retweets 0 likes
(Issue opened:) https://github.com/jbn/pytest-caprng/issues/5 …
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.