-
Notifications
You must be signed in to change notification settings - Fork 27
Conversation
@@ -759,7 +759,7 @@ class SuiteRunner( | |||
// |Java Classpath: ${sys.props("java.class.path")} | |||
} | |||
|
|||
def onFinishTest(testFile: File, result: TestState): TestState = result | |||
def onFinishTest(@deprecated("unused","") testFile: File, result: TestState): TestState = result |
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 fighting a symptom..
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.
Is the disease called "object-orientation"?
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.
Shouldn't it only warn on effectively final methods?
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.
@dwijnand I think that weakens the warning. Maybe two modes? strict vs non-strict? By the time you've written final
, you're less likely to have made a careless mistake such as this is designed to catch. So strict
mode would mean "I think I was careful."
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.
Sure, it weakens it, but I think I prefer a warning that you don't have to workaround.
(As a complete aside, IMO things should be final by default and you should have to annotate it open
, or something, rather than have to declare things final
).
comment(passFailString(passed.size, failed.size, 0) + " in " + kind) | ||
if (limping) comment(s"suite already in failure, skipping") else { | ||
val results = suiteRunner.runTestsForFiles(paths.map(_.jfile.getAbsoluteFile)) match { | ||
case Left((e, states)) => limping = true ; states |
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.
Shouldn't the unused e
warn? maybe that was one of the todo's noted in the tests for warnings.
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.
No, it's not built with the latest warnings yet. But for some reason it warns twice.
The result `TestState` is determined when the test is run (rather than throwing exceptions to enclosing infrastructure). Tests which haven't completed are deemed pending. Previously, tests that hadn't completed were deemed skipped. But skipping tests doesn't fail the build. Sample output with very short partest.timeout: ``` Selected 1815 tests drawn from 1 named test categories ok 1 - run/Course-2002-01.scala Thread pool timeout elapsed before all tests were complete! !! 2 - run/Course-2002-03.scala [non-zero exit code] !! 4 - run/Course-2002-02.scala [non-zero exit code] !! 3 - run/Course-2002-04.scala [non-zero exit code] !! 5 - run/Course-2002-05.scala [non-zero exit code] !! 6 - run/Course-2002-06.scala [non-zero exit code] !! 7 - run/Course-2002-08.scala [non-zero exit code] partest --update-check \ /home/apm/projects/snytt/test/files/run/Course-2002-02.scala \ /home/apm/projects/snytt/test/files/run/Course-2002-03.scala \ /home/apm/projects/snytt/test/files/run/Course-2002-04.scala \ /home/apm/projects/snytt/test/files/run/Course-2002-05.scala \ /home/apm/projects/snytt/test/files/run/Course-2002-06.scala \ /home/apm/projects/snytt/test/files/run/Course-2002-07.scala \ /home/apm/projects/snytt/test/files/run/Course-2002-08.scala \ /home/apm/projects/snytt/test/files/run/Course-2002-09.scala \ /home/apm/projects/snytt/test/files/run/Course-2002-10.scala \ /home/apm/projects/snytt/test/files/run/Course-2002-13.scala \ /home/apm/projects/snytt/test/files/run/Meter.scala \ /home/apm/projects/snytt/test/files/run/MeterCaseClass.scala \ /home/apm/projects/snytt/test/files/run/MutableListTest.scala \ /home/apm/projects/snytt/test/files/run/NestedClasses.scala \ /home/apm/projects/snytt/test/files/run/OrderingTest.scala \ /home/apm/projects/snytt/test/files/run/Predef.readLine.scala \ [etc] ``` Incomplete tests (in the category running when interrupted) are reported as pending: ``` ok 38 - pos/cls1.scala Thread pool timeout elapsed before all tests were complete! ok 39 - pos/cls.scala !! 40 - pos/collectGenericCC.scala [compilation failed] !! 41 - pos/chang [timed out] ok 42 - pos/clsrefine.scala [error] Failed: Total 41, Failed 2, Errors 0, Passed 39, Pending 1371 [error] Failed tests: [error] partest [error] (test/it:testOnly) sbt.TestsFailedException: Tests unsuccessful [error] Total time: 14 s, completed Apr 12, 2017 10:37:58 AM ```
005c698
to
8b5f550
Compare
@@ -759,7 +761,7 @@ class SuiteRunner( | |||
// |Java Classpath: ${sys.props("java.class.path")} | |||
} | |||
|
|||
def onFinishTest(testFile: File, result: TestState): TestState = result | |||
def onFinishTest(testFile: File, result: TestState): TestState = { unused(testFile) ; result } |
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 also wrong, imho..
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.
@dwijnand do you prefer pre or post syntax? an annotation to ignore or a reporter that knows to ignore it? This is a middle solution.
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.
I prefer the pre-syntax. IMO the unused param checker shouldn't warn on non-effectively final methods.
(Sorry I'm a little salty atm as I really want to use "warn unused"/Xlint in sbt/sbt but I've been dealing with lots and lots of these..)
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.
Finding the sweet spot for usability is hard, so input is appreciated. Warning on params was always assumed to be dicey. It sounds like: warn on final, unless asking for non-strict. Then, let me disable it with an annotation if I want.
I proposed this solution here because there's no extra machinery.
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.
Btw another false positive (ish) is enriching objects, e.g implicit def enrichFoo(f: Foo.type)
.
@som-snytt feel free to resubmit in scala/scala after https://github.com/scala/scala/pull/6566/files lands I'm sorry this was neglected :-/ in the new sbt-runner-only, in-sourced-partest world, I think we'll all be a lot more willing to review — and make — partest improvements. |
|
Let a timeout fail the build.
Runner.run determines the test state instead of throwing.