-
Notifications
You must be signed in to change notification settings - Fork 407
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
Allow Properties.overrideParameters to work correctly. #463
Conversation
Currently when run from SBT (i.e. ScalaCheckFramework), the overrideParameters method on Properties doesn't successfully override any parameters. This was because of the way the framework handles overrides coming from build configuration -- the framework unconditionally writes all parameter values, even when not explicitly set in the build. This commit reverses the order that these overrides are applied, so that build overrides (which are coarser) can be overridden by overrides in specific properties.
Previously we were iterating over a map, resulting in a different order than the sequence used to build the map. In the relevant case, we can just loop over the sequence instead. (The map in question _is_ useful to avoid repeatedly scanning the sequence when running certain properties by name.)
In
It's too bad we can't have both...override parameters in a class but be able to still override them from the command-line. That would also confuse the semantics of what an "override" does, though. |
Maybe add a note that this is the case in the doc comment for Write now the doc reads:
Should be something along the lines of:
|
@ashawley I agree the situation isn't ideal. I may try to work a bit harder to get things working as they were intended, but it's proved a tough nut to crack. Otherwise I agree that I'll need to change the documentation as you say. |
All that aside, I think this order is probably better in the long run. For example,
Personally, I would consider a local override (in code) to be more specific than a global override (on the command-line), since in the other order there's no way to allow different tests to use different values. All this aside, existing ScalaCheck docs say it should work the other way, so I'll see if I can get that working. I just thought it was worth making the case that this would possibly be a better design in the long run. |
There are other parameters besides just test counts, where you could make the same case or a different case. I tend to agree, though. If it is set in the class with It seems you've made the simplest fix, and is a good first pass at making it work. It hasn't worked since ScalaCheck 1.13.0 came out a few years ago. In my eyes, fixing it like this shouldn't close other avenues for changing it later. |
This commit does several things: 1. Ensures that overrideParameters applies *after* cmdline 2. Fixes initialSeed to work with Test.Parameters 3. Adds parameter to disable Shrink-based shrinking 4. Fixes numerous bugs around cmdline parsing 5. Adds tests to ensure Test.Parameters is working 6. Internal clean up and refactoring This commit includes the work from typelevel#463 and subsumes it.
I ended up folding this work into #522. |
Currently when run from SBT (i.e.
ScalaCheckFramework
),the
overrideParameters
method onProperties
doesn'tsuccessfully override any parameters. This was because
of the way the framework handles overrides coming from
build configuration -- the framework unconditionally
writes all parameter values, even when not explicitly
set in the build.
This commit reverses the order that these overrides are
applied, so that build overrides (which are coarser) can
be overridden by overrides in specific properties.
Fixes #221, #289, and #360.