-
-
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
Tweaks to tests (mmap robustness, don't use at-test_throw return type) #13090
Conversation
…ith them. Fixes issues on windows where OS complains when trying to mmap files that have already been mmapped/opened
I'm grepping through registered packages looking for anyone using the return value of |
Why is it a bad idea to let |
Rarely used feature, could instead be used for more general and uniform test result encapsulation, display, summaries, etc? |
It's expected since this is added during 0.4. The reason I added the return value to It seems wrong to me that whenever you want to test for anything other than the type (e.g. in order to make sure that the error is thrown at the expected place/function and has the necessary information included) you would have to go back to write the I'm not really familiar with That said I'm also totally fine with extending |
This is more a question for #13062 unless/until we also change the behavior of |
Mostly because it is new...
Sounds reasonable. Would still be nice to make it easier to test for other properties of the exception. Doesn't have to be using the return value and doesn't have to be directly the return value though. |
In the new proposal, it'd return a more general |
Could you elaborate why? |
So what would be a good pattern? |
................................................ Sorry I meant to cancel my comment which is redundant with Tony's.... |
Why
Could error because Or for why using the |
I think the necessary logic here is that if the expected exception type is returned, it might need to do some extra check on the exception. With return value I think what could be done is test_result = @test_throws FooError foo()
if test_result.pass
check_exception_thrown(test_result.exception)
else
# In case you want to print sth to help figuring out what might be wrong
end |
Here is how it works with the revised If not in a
|
I thought you mean including the error thrown ( The example you have above looks good to me. (And I guess for the not in |
Oh, I see your point now. I'm used to test frameworks where a test case bails out on the first failed Given that execution continues after the |
Yep its just a change to |
So this returning the exception thing was added in 0.4? That means backporting is even more reasonable then, right @tkelman ? |
That explains why it's not very widely used yet. We'd still be breaking it (putting in a slightly different but more general API instead) with a backport if it survives into 0.4.0 final, do we want to pre-emptively do anything about that now or not? |
The relevant line currently is |
Than add an function to access it? |
Its a function with literally one use though, extract the value of a |
I'd rather just un-document that |
I think it's fine to just revert #11984 and any other current use of it in the base test. |
This PR covers all uses in Base.Test |
So we're OK to merge this change first then? Any objections? |
Seems everyone ended up being satisfied with this |
Tweaks to tests (mmap robustness, don't use at-test_throw return type)
backported in #13107 |
try
-catch
instead of relying on@test_throws
to return the thrown exception.Both these came out of #13062 (the first is cherry picked, the second manually extracted).
Ping: @tkelman @StefanKarpinski