-
Notifications
You must be signed in to change notification settings - Fork 240
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
[BUG] DATAGEN_SEED=<seed> environment does not override the marker datagen_overrides #10089
Comments
We set |
I think it will be confusing to change what everyone is already used to, and that's setting DATAGEN_SEED. Instead I propose we use a different, internal-only environment variable to denote the randomly rolled seed generated by the test framework. |
ah makes sense to me now, this is the "I wrote it, so it makes sense to me" issue. Sorry! I'll put up a quick patch with this today. |
I don't think there is a good solution to this that does not violate the principle of lease surprise. Those that are used to how it works today will be surprised if it changes to override the overrides. Those who are not used to it will be surprised/are surprised if it does. Just pick names that are as clear as we can make it and document what it does. We can all adapt. I don't want the value that is used to set the DATAGEN_SEED to be hidden. It needs to be documented too so that the person who sets an override as a work around can test that they did it right. |
Also on that note do we need a new annotation to let us distinguish between, we are overriding the SEED temporarily to make the test pass until we can fix it vs the seed is hard coded because fundamentally there are problems that we cannot deal with. @jlowe I know you set a few of those, so I am curious if you have an opinion here. My main concern is that we get a failure and someone tries to test with the bad SEED (around all of the related tests) and because we cannot distinguish between the two a user ends up seeing test failures that are not directly related and they waste time trying to debug it. |
Having a different decorator (or argument to the existing decorator) to denote temporary vs. permanent is probably a good idea. We could omit the |
How often would we run into the situation @revans2 described if the user passes the |
if we admit there is no ideal solution I would side on making externally supplied adding more nuance to the To avoid confusions with blanket overrides affecting many different tests, we probably can find a way to raise an error if the pytest invocation involves more test node ids than a single specific prefix test_file.py::test_func |
I am leaning towards the following:
I think using the python options would be a cleaner way to deal with this, and yes we need to remember to add the modifier to the tests, but at least this is better than having to comment out the test marker. |
Ough found this while testing this change: #10108 Fixing it with the same PR. |
Why not allow DATAGEN_SEED to override by default if there is a single specific prefix test_file.py::test_func of collected nodeid |
I am leaning towards not doing this automatically because if 2+ functions are selected, |
I was trying to reconcile my requirement for this issue that DATAGEN_SEED should override unconditionally to reproduce a typical DATAGEN_SEED bug with the requirement of accidental overrides for unrelated tests. Another way to look at it, what is the current use case for setting DATAGEN_SEED for more than one test function? If the answer is none then we can just raise an error instead of having a different semantics. |
If multiple tests fail one could run them all with the different seed and they could be a whole class of tests, I don’t want to preclude that use case. Is it really that bad a user experience to set the extra argument I’ve proposed here? |
We are making this way too complicated (too many cooks in the kitchen). Lets just have DATAGEN_SEED override the seed for anything that is annotated/tagged with an override that is not permanent. Have an annotation that distinguishes between permanent and non-permanent. Either single tag or separate ones and be done with it. Any concerns I would have beyond that are really just minor and spending more time to "fix" them feels like a waste. |
My point is that an issue like #9992 contains a repro command (Github conveniently offers the user to copy it into the paste buffer with a single click at the top right corner). My expectation is that it reproduces the bug.
This takes us there in most cases, and the rest should have been already closed when making an override permanent. This is reasonable. |
Ok thanks all for the patience. Here's the latest and greatest, following the example in #9992, this is how it looks like when we set
If we don't set
If we specify the permanent flag:
|
We document the DATAGEN_SEED environment variable as a mechanism to reproduce test failures.
However, if a bug cannot be resolved in a timely manner, we resort to a constant seed that is known to pass the failing test using the
datagen_overrides
marker. However, such a marker disables DATAGEN_SEED which in turn invalidates the repro steps described in bugs like #9992We need to settle and document the precedence of various ways to set the seed.
The text was updated successfully, but these errors were encountered: