-
Couldn't load subscription status.
- Fork 1.4k
#1790 - A suite annotated with .only("some-label"), will ignore all non matching labels
#1838
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
Conversation
|
I understand this is a useful scenario to support, I think we should reflect on how we can do this (and if we can, in the right way now), since in this design we cannot enforce the "outer suite" requirement. |
|
One idea I had is once we get effectual suites in perhaps we can have a function like: def testOnly[R, E, L, T](f: TestAspectPoly => Spec[R, E, L, T]): Spec[R, E, L, T] = {
val specs = for {
ref <- Ref.make[Vector[Spec[R, E, L, T]]
only = new TestAspectPoly { ... } // TestAspect that adds any tests it is called on to the ref
_ <- f(only)
specs <- ref.get
} yield specs
Spec.suite("Only", specs, None)Then you could use it like: testOnly { only =>
suite("MySuite")(
test1,
test2 @@ only,
test3
)
} |
|
@adamgfraser Yes, that's a much better API! It should work for now, and we can think about whether to do this with annotations later. |
|
@dkarlinsky We just merged #1664 which makes suites effectual so I think now we really have the tools to implement your idea. Do you want to rework this PR along the lines I suggested? Would be great to get some feedback on working with the new effectual suites functionality and I think this would be a nice feature to have. |
|
Yes, I would like to work on this. I'm currently on vacation in Australia,
though :) I do have my laptop with me, so I'll try to get some work in, but
not sure how much.
…On Fri, Oct 4, 2019, 1:11 PM Adam Fraser ***@***.***> wrote:
@dkarlinsky <https://github.com/dkarlinsky> We just merged #1664
<#1664> which makes suites effectual so I
think now we really have the tools to implement your idea. Do you want to
rework this PR along the lines I suggested? Would be great to get some
feedback on working with the new effectual suites functionality and I think
this would be a nice feature to have.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1838?email_source=notifications&email_token=AAMBET2ZXEVVDOD3R3LH7ODQM2X57A5CNFSM4I22B4NKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAKHAYY#issuecomment-538210403>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAMBET75QFS5WPJ6HXRH5TDQM2X57ANCNFSM4I22B4NA>
.
|
|
@dkarlinsky Sounds good. No rush. Enjoy your vacation! |
|
Thanks!
…On Fri, Oct 4, 2019, 8:04 PM Adam Fraser ***@***.***> wrote:
@dkarlinsky <https://github.com/dkarlinsky> Sounds good. No rush. Enjoy
your vacation!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1838?email_source=notifications&email_token=AAMBET6GML75GYKCC5PORKLQM4IJNA5CNFSM4I22B4NKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEALFTEQ#issuecomment-538335634>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAMBETYJTRNLK64HUCQ6CT3QM4IJNANCNFSM4I22B4NA>
.
|
|
I will close this, @dkarlinsky, feel free to re-open when you have time to add this great feature! |
|
@jdegoes Back from vacation (landed yesterday) and now ready to give this another shot :) |
|
Done! |
|
Thank you!
…On Sat, Oct 26, 2019 at 2:37 PM John A. De Goes ***@***.***> wrote:
Done!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1838?email_source=notifications&email_token=AAMBET75SGMKR5DND3AMQZLQQQTYPA5CNFSM4I22B4NKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECKGBGY#issuecomment-546594971>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMBETYZPIPGGDFVOOMFUV3QQQTYPANCNFSM4I22B4NA>
.
|
@@ thisOnly, will be the only one that runs.only('some-label), will ignore all non matching labels
.only('some-label), will ignore all non matching labels.only("some-label"), will ignore all non matching labels
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice progress on this. I left some comments below. I think we can both improve the ergonomics of this and simplify the implementation a lot by using filterLabels and either calling toString on the labels or requiring evidence that they are already strings so we can do a substring search on them. This will also make the API consistent with what we are doing in the SBT test runner for "only".
a126bd8 to
fb0c0cc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few minor comments. Excited to get this in!
|
@dkarlinsky We merged #2192 which created the same test file and is creating a merge conflict. Should be easy to drop your tests in. |
Now `.only(labelFilter)` can be added to a suite. If no matching labels are found, the test fails with exception.
* `.only()` will only work on ZSpec with L <: String. * Using `filterLabel()`. * Moved `only()` method into Spec (no longer an extension method)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
…all non matching labels (zio#1838) * Rewrote the whole thing. Now `.only(labelFilter)` can be added to a suite. If no matching labels are found, the test fails with exception. * Fixing method overloading issue in dotty, by renaming the offending method * added scala docs * Simplified implementation. * `.only()` will only work on ZSpec with L <: String. * Using `filterLabel()`. * Moved `only()` method into Spec (no longer an extension method) * Moved test to the newly created `SpecSpec` * adapting to ZSpec changes * scalafmt * minor fixes, based on PR comments * some more minor fixes, based on PR comments
New method
Spec.only(), that when applied on a suite will ignore all tests that don't have the given substring in their label.Requires evidence that
Lto be String and theSpecisZSpecExample:
This requires an outer suite to be marked with @@ thisOnlySupport.OrTeatAspects.runOnlySupportneeds to be added to default aspects.To make this work I had to add a notion oftagstoTestCase@adamgfraser WDYT?