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
[jvm] Hook up the ability to run JUnit tests written in Scala #13868
Conversation
…rceField for junit test files. [ci skip-rust]
[ci skip-rust]
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust]
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.
Neat!
# ----------------------------------------------------------------------------------------------- | ||
|
||
|
||
class JunitTestSourceField(SingleSourceField, metaclass=ABCMeta): |
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.
It's confusing imo for this to subclass SingleSourceField
and then for the subclasses of this to also subclass JavaSourceField
and ScalaSourceField
. it works, but confusing.
Instead, I recommend calling this JunitTestSourceMixin
, and it's nothing more than a marker type. Doesn't subclass anything, not even ABCMeta
.
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.
That won't work I don't think: this does actually need to be a SourcesField
subclass, because it is used with a FieldSet
.
class JvmRequirementsField(SpecialCasedDependencies): | ||
alias = "requirements" | ||
required = True | ||
help = ( | ||
"A sequence of addresses to targets compatible with `jvm_artifact` that specify the coordinates for " | ||
"third-party JVM dependencies." | ||
) |
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.
Thanks, I was about to delete this :)
The
scala_junit_tests
target was added in #13130, and became compilable from the JUnit@rules
in #13519. The final piece to enable actual usage is to allow the JUnit@rules
to match non-Java sources.This change adds the
JunitTestSourceField
marker, which is extended byJavaJunitTestSourceField
andScalaJunitTestSourceField
, and tests that JUnit tests can be written in Scala.[ci skip-rust]