Skip to content
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

Use test_throws instead of test_broken in Float16 numbers tests #17396

Merged
merged 2 commits into from
Jul 14, 2016

Conversation

tkelman
Copy link
Contributor

@tkelman tkelman commented Jul 13, 2016

Since test_broken is not good for things that currently error but when fixed will return non-boolean.

If you know how to fix the inference issue and get tests to pass with #17394 (377dede) reverted, then please do so and close this PR.

Since test_broken is not good for things that currently error
but when fixed will return non-boolean.

If you know how to fix the inference issue and get tests to pass
with #17394 (377dede) reverted,
then please do so and ignore this change.
@@ -2771,7 +2771,8 @@ let types = (Base.BitInteger_types..., BigInt, Bool,
for S in types
for op in (+, -)
if S === Float16 # type instability here?
@test_broken @inferred Base.promote_op(op, S)
# broken, fixme then remove this branch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the whole point of @test_broken is that it can show up in the report as broken. Since it doesn't work for this, it's better to just disable the test (i.e. remove the @inferred) and leave a comment. @test_throws is almost certainly the wrong thing to do.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should change @test_broken to allow the argument to either fail or throw. Or introduce another macro @test_broken_throws, although in that case I'd be tempted to rename these macros as @broken_test and @broken_test_throws... Or maybe better still spell them as @broken @test and @broken @test_throws, etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that @test_broken is currently a replacement of @test. So if @test foo is broken, you replace it with @test_broken foo. However, here @inferred is the @test so using @test_broken or @test_throws like this is effectively writing @test_throws @test or @test_broken @test. I think we could possibly make this a valid use of @test_broken but this is almost certainly not a valid use of @test_throws.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is test_throws wrong? it achieves the test_broken purpose of being noisy and loud and making you fix it if the test changes result. we don't have a report right now so the count of broken tests isn't visible anywhere except via grep

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's wrong in the same way using @test !foo instead of @test_broken foo is wrong.

Copy link
Contributor Author

@tkelman tkelman Jul 13, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before we had @test_broken that wasn't all that wrong, for making more-visible fixme's.
And neither of those deal with exceptions (test_broken allows them, but doesn't tell you if something changes result from exception to non-boolean), @test_throws does.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before we had @test_broken the right way was commenting the test out. Now we have @test_broken the right way is to make @test_broken @inferred works.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, commenting the test out doesn't tell you when you fixed the behavior - that's much more of the point of what @test_broken is useful for. Yes, rewriting @test_broken @inferred to do the right thing would be a good idea, but is also more messing with macros than I have the patience for right now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... OK apparently @inferred is not even a test. In that case I'm fine with using @test_throws for now. Note that using this on a test will mess things up.

julia> @test_throws ErrorException @test false
Test Failed
  Expression: false
Test Passed
  Expression: @test false
      Thrown: ErrorException

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah @inferred isn't a first-class member of the test system in terms of behavior or return types, it's a separate mostly-independent utility

@tkelman tkelman merged commit 6cbfe5f into master Jul 14, 2016
@tkelman tkelman deleted the tk/numberstest2 branch July 14, 2016 04:51
@kshyatt kshyatt added the test This change adds or pertains to unit tests label Jul 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test This change adds or pertains to unit tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants