Does anyone know of a @pytestdotorg plugin that cache's
- `random.getstate()`
- `numpy.random.get_state()`
so that, on failure, `--lf` runs under the same pRNG conditions? I can't find one, and that's a really easy bit of #python code to write.
-
Show this thread
-
Replying to @generativist @pytestdotorg
I'm not familiar with one, but should be pretty simple to add a session-scoped fixture which monkey-patches those two functions, saving it using the cache fixture.
1 reply 0 retweets 1 like -
Replying to @nicoddemus @pytestdotorg
I think it may need to be implicitly done on something like "--replay-np-prng" w/o the monkeypatch, at least for numpy. randomstate doesn't export the cython interface. So, I've had problems with
@anacondainc autojit-ing. But, it's an easy plugin either way.1 reply 0 retweets 0 likes -
Replying to @generativist @nicoddemus and
P.S. Just looked at your bio. You're clearly the authority here since I just picked up pytest via
@brianokken's book two weeks ago. So your advice is appreciated! My take was from my (possibly overly specific) experience, sorta explained here: https://github.com/numpy/numpy/issues/7861 …2 replies 1 retweet 3 likes -
Replying to @generativist @nicoddemus and
Now that I think about this out loud though (sorry), my solution wouldn't work. If you do `--lf` and there are many stochastic functions, you don't capture the exact state for an individual test. Has to be function scoped.
1 reply 0 retweets 1 like -
Replying to @generativist @pytestdotorg and
That's a good point, did not thought about that.
1 reply 0 retweets 1 like
Got a working example in my dissertation's http://conftest.py thanks this issue thread (that you participated in): https://github.com/pytest-dev/pytest/issues/230 … Sound uncover any problems in a day or two with a packaged plugin by the end of week. Thanks!
-
-
Replying to @generativist @pytestdotorg and
Awesome, glad that was useful to you!
0 replies 0 retweets 2 likesThanks. Twitter will use this to make your timeline better. UndoUndo
-
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.