-
Couldn't load subscription status.
- Fork 92
Migrate majority of partest jvm tests to JUnit #6
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
|
LGTM. You didn't mention the motivation: remove a needless build cycle among our modules. But even aside from that, I think the move makes sense and might make it easier for people to contribute to the module. Looking forward a bit, you could express the neg tests with a tiny wrapper around the toolbox compiler as we did for scala-async: https://github.com/scala/async/blob/master/src/test/scala/scala/async/package.scala |
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.
If you have this annotation for the IDE, it shouldn't be needed.
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 was for the IDE. I remember it didn't work before.
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.
In fact, having @RunWith and @Test breaks the junit-interface in SBT 0.13! https://github.com/szeiger/junit-interface/pull/25
@szeiger, I think your PR queue needs some attention! :)
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 only needed if you're using specs or scalatest (without the scalatest plugin).
|
One of the tests is noisy: |
|
Under SBT, the JUnit tests run with an old version of scala-xml: |
|
Good catch, @retronym! This is why I print the header with full version info/classpath on all partest runs. Maybe we should consider something similar here. |
|
Here's how to tweak the This seems to be the least intrusive way to do this. An alternative would be to modify BTW, I've split it out like that because I need to do the same for another configuration to add code coverage to the build: |
|
@retronym Scala classes are cached independently of the managed classpaths in a higher class loader. The purpose is to avoid needing to reload/re-jit the classes, so caching on the exact classpath means you would load the classes in new class loaders if one project needs scala-xml and another doesn't and there would be another class loader for scaladoc, the compiler, etc... Instead, there is one class loader with everything, and then a FilterLoader that ensures that the application only sees classes that come from the classpath. This could possibly get confused when metadata is not accurate or there are cycles. This should be rare and is probably specific to Scala and its modules. It could also be a bug. You can always fork if necessary. |
|
@retronym great coverage report! |
|
If we examine the classpath of Note that the order of entries on classpath is correct so it's probably bug in sbt. However, I think the best course of action would be to get rid of |
|
Yeah, duplicate Scala classpath entries is probably a wontfix. |
As discovered here: scala#6 (comment) we would have two different versions of scala-xml on test classpath: 1. scala-xml classes compiled from source (we are in scala-xml project) 2. scala-xml transitive dependencies of partest Duplicated classpath entries are always dangerous. I implemented a set of exclude rules that get rid of transitive dependencies of scala-xml. This fixes the problem of JUnit using wrong version of scala-xml for testing (now there's only one choice). Also, this allowed me to to enable conflictWarning again. They are very useful to warn us against dangerous situations that almost always result in broken classpath (as we just learned).
Migrated to JUnit the following tests (from test/files/jvm): * t0632.scala * t1118.scala * unittest_xml.scala None of those tests were dependent on anything jvm specific.
It doesn't seem to test anything XML-specific and I couldn't trace what kind of backend problem this test is supposed to guard against.
|
LGTM. Lets book the progress. I confirmed that throwing an exception in the implementation indeed fails the tests. Looking forward to the rest of the transition. |
Migrate majority of partest jvm tests to JUnit
|
Thanks guys! |


I'm logging progress on JUnit migration and I wanted to get feedback if this is a good direction.