-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Replacement for Base.Test (ready for review) #13062
Conversation
💯 For Travis esp for the standard library tests I think another Todo would be collapsed output. If all the tests within a testfile pass then a summary is printed instead of the detailed output. The detailed output is only expanded when one or more tests fail within a given file. |
2dfb5ef
to
8aca6fc
Compare
@tkelman any ideas why |
@@ -3100,15 +3100,25 @@ Base.convert(::Type{Foo11874},x::Int) = float(x) | |||
|
|||
# issue #9233 | |||
let | |||
err = @test_throws TypeError NTuple{Int, 1} |
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.
you can't make @test_throws
return the error?
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'd be inconsistent with @test
. Now everything returns a test object, with nice behaviour at the REPL as a result. I think using @test_throws
as a one-liner try-catch was not a good idea to begin with, although thats completed unrelated to why I picked the return type.
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.
okay fair enough, sounds like there's a good reason for the change. slightly breaking if any packages were doing this, but probably worth it
+100. This is the one thing I've wanted as far as incremental improvements to Base.Test go. |
👍 💯 I'd lobbied for just this sort of thing a while ago, great to see something like this actually being built. |
This is exciting... do you see it making FactCheck.jl obsolete at some On Fri, Sep 11, 2015 at 10:51 AM, Scott P. Jones [email protected]
|
@tbreloff it makes FactCheck obsolete for my personal needs, and I won't be working on it any more, but as a package it is always going to have much more flexibility in how it does things because it can be quite opinionated/crazy if it wants. |
@IainNZ, my guess is the |
@quinnj Yes that makes sense. This shouldn't be keeping any references around any longer than the old |
Just pushed some changes that make mmap tests pass on my windows machine. |
(to this PR) |
Hah, well I'll be damned, very nice work. |
698d920
to
b44700b
Compare
Ok, lets see how CI likes that |
To quote from the #13090: with err = @test_throws TypeError NTuple{Int, 1}
@test err.func == :NTuple
@test err.expected == Int
@test err.got == Int becomes (if try
NTuple{Int, 1}
@test false
catch err
@test isa(err, TypeError)
@test err.func == :NTuple
@test err.expected == Int
@test err.got == Int
end I think the first is more clear, and the extra |
I don't think the first is more clear, I think its using |
b44700b
to
8998a8b
Compare
OK, now returns the exception value always (not just on failure) |
8998a8b
to
613b0fd
Compare
Now #13090 is in, rebased. |
Cool work @IainNZ |
I guess anywhere in the testing docs that mentions handlers should probably be updated here since that mechanism is being removed. |
Yeah I pulled that out of the helpdb thing to get it to compile, but I need to substantially rewrite that chapter before merging this. |
So I'm trying to do something sensible with
actually passes all the tests in base, but that just might be because its easier to satisfy than the current criteria (it is essentially Is punting on "integrating" these into the new framework a viable option? I'm running out of time and steam for this PR. My preferred option would be to actually deprecate them in favour of using |
Yes, punting on these is very reasonable. I'd love to get rid of them altogether. They should be normal tests with a different predicate, not some weird special testing macro. |
@IainNZ, if you want to use the more-stringent But I agree with @StefanKarpinski that it would be better to get rid of those special test macros eventually. |
Is it expected that passed testsets are displayed if their sibling fails? e.g. @testset "outer" begin # should be displayed
@testset "inner 1" begin # should not be displayed?
@test true
end
@testset "inner 2" begin # should be displayed
@test false
end
end gives
I don't really have a preference one way or the other (it could provide some extra context), but the docs say:
which makes it sound like it might be a bug. |
BTW, I don't think that has to be a blocking issue even if it's not intended behavior. I know you're trying to tie a bow on this thing so if it merges as-is and we file an issue, I can look into it. Or just change the docs. :) |
Replacement for Base.Test (ready for review)
Great! |
Needs a 0.5 NEWS entry... |
Is backporting to 0.4 viable? |
@ssfrr it is intentional, I guess I just view it differently. So if a testset has a failure, then that failure is also associated with its parent. If I hid the "sibling" test sets it looks a bit confusing (especially when their a multiple failures), because the "children" don't sum up to the parent's totals |
Backporting a new feature like this doesn't make sense to me. |
Not even to 0.4.1? |
Is that possible to provide this as a separated package (or Compat.jl)? I really want to use it! |
It's a big feature, but not really a normal language feature. The question is what breaks if we change this? |
Anything using I could maybe add deprecation machinery for it? |
(it was mostly used for lack of an easy way to not stop on the first failing test, and a lot of the results in that search are forks of Julia) |
We can also still technically sneak features into 0.4 since it's not final yet. @IainNZ, how painful will maintaining support for two different Base testing APIs be? |
I'll investigate today, I'm guessing not terrible. |
I'm very much against backporting anything into release-0.4 right now that isnt a critical bugfix or absolutely harmless (like doc additions). We've done 2 rc's already, now's not the time. Maybe for 0.4.1. |
Well, 0.4.1 isn't the time since technically this is a breaking change and that would violate our principle that your code should not break between 0.4.0 and 0.4.1; otoh, there's no such promise going from 0.4.0-rc2 to 0.4.0. |
We're trying to get a release out that's way behind schedule. This needs people testing and using it, it is several hundred lines of code after all. We're technically being stricter than semver since we're pre 1.0. The least risky way of supporting this on 0.4 is as a package. |
Can the changes to |
the other breaking change is the return value of |
You should check for the version where JuliaLang/julia#13062 was merged.
The goal of this PR is to make
Base.Test
better than justassert
with some fancier output. It does so primarily by introducing@testset
, which lets users bundle tests together and delay throwing an error until the end.Design-wise, it primarily needs to be non-breaking for 99.9% uses of the current
Base.Test
, and be simple, minimal, and relatively opinion-free. It is clear there is a large space of possibilities for testing frameworks, but I don't want to go there (personally). My goal is for a incremental improvement over the existingBase.Test
- if someone wants to pick up the ball and add more features later, they can. A thing that falls outside the scope includes fancier outputs (to, e.g. files).This PR is basically https://github.com/IainNZ/BaseTestNext.jl. It is a drop-in replacement for
Base.Test
, and all tests except for those intest/test.jl
pass without modification.Features for later PRs (probably not by me):
@test_approx
needs to be either included in the testset world, or even better deprecated in favor ofisapprox
based testing.Some demo output from BaseTestNext.jl