-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Fix swallowed exception in Request.classes(...) #1065
Conversation
The method classes(Computer computer, Class<?>... classes) in org.junit.runner.Request swallows an InitializationError and throws a new RuntimeException instead when it cannot create a request. This prevents the user from finding out why the request could not be created. This change replaces throwing a new RuntimeException with generating a proper error report. The report contains the causes of the InitializationError so the user has a chance to find out what is causing the problem.
PS: if you came here because you just updated Tycho to version 0.22, your tests don't run any more and you googled <plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<parallel>classes</parallel>
<perCoreThreadCount>true</perCoreThreadCount>
<threadCount>1</threadCount>
</configuration>
</plugin> |
Could you include in this pull a test that calls |
I added a test that triggers the exception when calling |
65887fc
to
8500552
Compare
LGTM |
@Override | ||
public Description getDescription() { | ||
Description description = Description.createSuiteDescription(testClass); | ||
Description description = Description.createSuiteDescription(classNames); |
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.
This is an externally visible change for the case where the existing constructor is used.
Instead of making suggestions here, I'm going to create a pull with your commits and one additional commit to fix this and to fix some other minor issues.
The other pull is just to make reviewing my proposed changes easier; I still plan on merging your pull. Details to follow soon.
I patched your branch into my repository, added a match to fix the backwards compatibility issue. You can view it at #1072 Note there isn't much tests for the changes to It's a bit more complicated than I would like. I'm tempted to say that we should not change If you like the direction, but want to make some changes, feel free to pull from my branch back to yours. To make reviewing simpler, I suggest not squashing commits for now. |
@kcooney your changes look similar to something I also had but though to be too complicated ;-) |
@acanda as I stated before, I wasn't excited about the complexity of my changes either. That's why I was wondering whether we really need to include all of the classes passed to |
The code was changed by commit 0804ef4 but unfortunately the test was not part of the commit. I recovered the test from Philip Graf's original pull request junit-team#1065. Co-authored-by: Philip Graf <[email protected]>
The code was changed by commit 0804ef4 but unfortunately the test was not part of the commit. The test is based on Philip Graf's test in pull request junit-team#1065. Co-authored-by: Philip Graf <[email protected]>
The code was changed by commit 0804ef4 but unfortunately the test was not part of the commit. The test is based on Philip Graf's test in pull request junit-team#1065. Co-authored-by: Philip Graf <[email protected]>
This pull request has been continued in #1072. |
The code was changed by commit 0804ef4 but unfortunately the test was not part of the commit. The test is based on Philip Graf's test in pull request #1065. Co-authored-by: Philip Graf <[email protected]>
The code was changed by commit 0804ef4 but unfortunately the test was not part of the commit. The test is based on Philip Graf's test in pull request junit-team#1065. Co-authored-by: Philip Graf <[email protected]>
The code was changed by commit 0804ef4 but unfortunately the test was not part of the commit. The test is based on Philip Graf's test in pull request junit-team#1065. Co-authored-by: Philip Graf <[email protected]>
The method classes(Computer computer, Class<?>... classes) in
org.junit.runner.Request swallows an InitializationError and throws a
new RuntimeException instead when it cannot create a request. This
prevents the user from finding out why the request could not be created.
This change replaces throwing a new RuntimeException with generating a
proper error report. The report contains the causes of the
InitializationError so the user has a chance to find out what is causing
the problem.
Instead of an incomplete stack trace with the message "Bug in saff's brain: Suite constructor, called as above, should always complete" like
the user gets an error report like