Conversation
They can also be manually disabled by setting `CHAINRULES_TEST_INFERRED` to `false`. I have tested that all tests still pass with `JULIA_PKGEVAL` set to `true`, do we need to test for that by spawning a new Julia process? Once this is merged, I plan to replace occurences of `@inferred` in ChainRules with `@maybe_inferred` as well, therefore I exported that macro.
src/ChainRulesTestUtils.jl
Outdated
|
|
||
| function __init__() | ||
| TEST_INFERRED[] = !parse(Bool, get(ENV, "JULIA_PKGEVAL", "false")) && | ||
| parse(Bool, get(ENV, "CHAINRULES_TEST_INFERRED", "true")) |
There was a problem hiding this comment.
Possible we want:
TEST_INFERRED[] = if haskey(ENV, "CHAINRULES_TEST_INFERRED")
parse(Bool, "CHAINRULES_TEST_INFERRED")
else
!parse(Bool, get(ENV, "JULIA_PKGEVAL", "false"))
end
which as truth table
for C being ENV[CHAINRULES_TEST_INFERRED] and
P being JULIA_PKGEVAL
and X marking not defined
C P R
-----
X T F
X F T
F F F
F T F
T F T
T T T
T X T
F X F
X X T
over
TEST_INFERRED[] = !parse(Bool, get(ENV, "JULIA_PKGEVAL", "false")) &&
parse(Bool, get(ENV, "CHAINRULES_TEST_INFERRED", "true"))
which has
C P R
-----
X T F
X F T
F F F
F T F
T F T
T T F
T X T
F X F
X X T
The difference is the
T T T vs T T F.
I.e. if the ChainRules specific environment variable is present, it would override the JULIA_PKGEVAL.
Which feels right to me.
If someone specifically states they want these tests to run that is stronger than if it happens to have this enviroment varaible set.
Also do we want to handle the variables not being set to parsable values?
If so could be done with try_parse + something, or the a try-catch + give an informative message.
There was a problem hiding this comment.
Maybe we don't need the two env-vars.
Maybe we just need !parse(Bool, get(ENV, "JULIA_PKGEVAL", "false")) to see the default value.
And then for normal users (and for overwriting) we can document doing ChainRulesTestUtils.TEST_INFERRED[]=false / ChainRulesTestUtils.TEST_INFERRED[]=true
Maybe that is better?
There was a problem hiding this comment.
I think a separate environment variable might still be useful, since otherwise, you'd have to manually edit the testing code to disable these. I didn't really expect the two env vars to ever really be set at the same time, but just for consistency's sake I agree that your version makes more sense, so I will go with that instead if that's ok.
| end | ||
|
|
||
| """ | ||
| @maybe_inferred f(...) |
There was a problem hiding this comment.
Can we think of a better name for this?
Might not be able to.
There was a problem hiding this comment.
maybe_test_inferred is perhaps more accurate?
There was a problem hiding this comment.
I wish @inferred has been named @test_inferred (and that it returnned a bool rather than erroring)
There was a problem hiding this comment.
I agree that it's not the greatest name, but I couldn't really think of a better one. Since it isn't an actual test I don't think it should have test in its name, but I am open to any other suggestions.
There was a problem hiding this comment.
We could make it an actual test
There was a problem hiding this comment.
I think I'd prefer to make it consistent with base, so it's just a drop-in replacement for @inferred. We could think about having an @maybe_test_inferred as well, but for now this seems more straightforward to me.
We do not. |
oxinabox
left a comment
There was a problem hiding this comment.
Needs adding to docs.
I trust your judgement wrapping things up here, and addressing the points i raised appropriately.
Co-authored-by: Lyndon White <oxinabox@ucc.asn.au>
|
I plan on merging this tomorrow afternoon if there are no objections. |
|
Oh, sorry, I thought I bumped the version as well, but seems like I missed it. Ok if I just do that as a commit straight to master or is the proper way to do this in its own PR? |
|
yeah just commit the version bump |
ref JuliaDiff/ChainRulesTestUtils.jl#165. I will bump the version as well once #434 is merged so that PkgEval picks this up.
ref JuliaDiff/ChainRulesTestUtils.jl#165. I will bump the version as well once #434 is merged so that PkgEval picks this up.
Make rand_tangent on adjoint an transpose return natural
They can also be manually disabled by setting
CHAINRULES_TEST_INFERREDto
false. I have tested that all tests still pass withJULIA_PKGEVALset to
true, do we need to test for that by spawning a new Juliaprocess? Once this is merged, I plan to replace occurences of
@inferredin ChainRules with@maybe_inferredas well, therefore Iexported that macro.