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

test_rrule says that it didn't run any tests #121

Closed
yha opened this issue Mar 8, 2021 · 4 comments · Fixed by #122
Closed

test_rrule says that it didn't run any tests #121

yha opened this issue Mar 8, 2021 · 4 comments · Fixed by #122

Comments

@yha
Copy link

yha commented Mar 8, 2021

Using the example from the docs:

using ChainRulesCore
using ChainRulesTestUtils

function two2three(x1::Float64, x2::Float64)
    return 1.0, 2.0*x1, 3.0*x2
end

function ChainRulesCore.rrule(::typeof(two2three), x1, x2)
    y = two2three(x1, x2)
    function two2three_pullback(Ȳ)
        return (NO_FIELDS, 2.0*Ȳ[2], 3.0*Ȳ[3])
    end
    return y, two2three_pullback
end

test_rrule(two2three, 3.33, -7.77)
Test Summary:                      |
Don't thunk only non_zero argument | No tests
Test.DefaultTestSet("Don't thunk only non_zero argument", Any[], 0, false)

version info:

  [d360d2e6] ChainRulesCore v0.9.29
  [cdddcdb0] ChainRulesTestUtils v0.6.3
Julia Version 1.5.2
Commit 539f3ce943 (2020-09-23 23:17 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: Intel(R) Core(TM) i7-9800X CPU @ 3.80GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-9.0.1 (ORCJIT, skylake-avx512)

If this is not implemented yet, then probably the ChainRules docs shouldn't point to this package at this stage.

@mzgubic
Copy link
Member

mzgubic commented Mar 8, 2021

Thanks for pointing this out!
Try

@testset begin 
           test_rrule(two2three, 3.33, -7.77)
       end

I don't actually know why the printout is as it is, but I am pretty confident the tests run. If, for example, you write an incorrect rule, that will show up as test failing.

@oxinabox
Copy link
Member

oxinabox commented Mar 8, 2021

It does so run tests.
The output is just not showing you the tests that passed earlier.

The output is just the last set it ran.
There is I think an issue about fixing that to show something more relevant.

Wrap the whole thing in. @testset and you will see that it reports many years run.

Get you rule wrong and it will fail you.

@mzgubic
Copy link
Member

mzgubic commented Mar 8, 2021

Maybe you mean this one?
#108

@oxinabox oxinabox changed the title test_rrule doesn't run any tests test_rrule says that it doesn't run any tests Mar 8, 2021
@oxinabox oxinabox changed the title test_rrule says that it doesn't run any tests test_rrule says that it didn't run any tests Mar 8, 2021
@yha
Copy link
Author

yha commented Mar 8, 2021

Oh, that does make sense. I suppose I'll wrap this call with a @testset for now to get nicer REPL output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants