-
Notifications
You must be signed in to change notification settings - Fork 405
Increase Fidelity of the sbt.testing.Framework Implementation #1107
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
base: main
Are you sure you want to change the base?
Increase Fidelity of the sbt.testing.Framework Implementation #1107
Conversation
05bd678
to
7ce3e5f
Compare
7ce3e5f
to
da9cb92
Compare
@satorg any thoughts? |
da9cb92
to
4a468a9
Compare
@dubinsky thank you for the PR and sorry for the long reply! Personally, I'd love to get both PRs (this and #1031) merged ultimately. I just don't feel very confident about this ScalaCheckFramework implementation, because I personally don't use it and mostly rely on other test framework runners. Do you think your PR complements #1031 or supersedes it completely? |
…dcardSelector`s, filter properties to run by matching their names against the `Selector`s; - added a test that actually runs ScalaCheck via the `SBT Test Interface` and demonstrates the (now correct) treatment of the `Selector`s; - test also demonstrates two unfixable infidelities in the treatment of the nested properties; - thankfully, ScalaCheck's implementation of `sbt.testing.Framework` is, unlike in some other test frameworks, shared between the platforms (JVM, Scala.js, Scala Native), so the fixes do not have to be replicated for each platform, but: - the test needs to supply a `testClassLoader: ClassLoader` parameter when calling `sbt.testing.Framework.runner()`; on platforms other than JVM, `getClass.getClassLoader` is not available, so `Platform.getClassLoader: ClassLoader` method was added to every `Platform`; on platforms other than the JVM, it returns `null`, which is fine since on those platforms `sbt.testing.Framework.runner()` ignores the `testClassLoader` parameter anyway. fixes typelevel#1105
4a468a9
to
2e33740
Compare
Code changes have comments, tests are added that verify the change, and issue #1105 has detailed explanations. Is there anything else I can do? Are you going to involve other contributors/maintainers that are more familiar with this area or do you have specific questions?
My pull request completely supersedes #1031: it handles both Thank you! |
// For TestSelector, exact comparison with both the full name and the name with | ||
// the suite prefix (properties.name) stripped off works for non-nested suite, | ||
// but results in a false negative for nested suites: test "A.B.test" can not be | ||
// selected by its short name "test"; | ||
// instead, selected test name is matched using `endsWith`. | ||
case s: TestSelector => name.endsWith(s.testName()) |
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.
@dubinsky , just to clarify: for nested test suites, shouldn't NestedTestSelector
be used instead?
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.
As far as I understand, for selecting the tests to run, only TestSelector
and TestWildcardSelector
are used; NestedTestSelector
should be used for reporting status of a test that is nested. As I mentioned further down, inability to correctly report nested tests is one of the unfixables in ScalaCheck; at least it can be fixed to run the correct tests ;)
@dubinsky , thank you for your work on this issue. I found some time to wrap my head around SBT testing API, so that now I think understand what is going on there to some extent. If you are still interested, I guess we can get your PR merged. However, I wouldn't like to dismiss the effort made in #1031 too, since it was kinda preceding yours. How about if I merge the former PR first, then you'll update yours overwriting conflicting parts and we'll merge your PR right after? Thereby everyone will get involved. @Duhemm, in a case you are still around, let us know if you are OK with this plan please. Thanks everyone! |
My pleasure!
Yes.
Of course! Thank you! |
@dubinsky , do you have any clue what |
They are called by the Test Interface/Test Bridge on Scala.js and Scala Native to transport the task information from JVM to Node.js/Native code. |
Selector
s supplied include onlyTestSelector
s andTestWildcardSelector
s, filter properties to run by matching their names against theSelector
s;SBT Test Interface
and demonstrates the (now correct) treatment of theSelector
s;sbt.testing.Framework
is, unlike in some other test frameworks, shared between the platforms (JVM, Scala.js, Scala Native), so the fixes do not have to be replicated for each platform, but:testClassLoader: ClassLoader
parameter when callingsbt.testing.Framework.runner()
; on platforms other than JVM,getClass.getClassLoader
is not available, soPlatform.getClassLoader: ClassLoader
method was added to everyPlatform
; on platforms other than JVM, it returnsnull
- which is fine, since on those platformssbt.testing.Framework.runner()
ignores thetestClassLoader
parameter anyway.fixes #1105