I’m encountering an issue with CI on github. If I define
julia> foo(x) = nothing
foo (generic function with 1 method)
and do a @test_throws
with it, I would expect it to throw a MethodError
like here
julia> foo(; x = 1)
ERROR: MethodError: no method matching foo(; x=1)
Closest candidates are:
foo(::Any) at REPL[1]:1 got unsupported keyword argument "x"
Stacktrace:
[1] top-level scope
@ REPL[4]
but it seems to throw an ArgumentError
instead.
The same issue happens for 1.6.6 and 1.7.3 on CI (throws ArgumentError
instead of MethodError
). On my local machine running 1.7.3 it always throws a MethodError
.
At the current stage, I would consider this a bug but I’m at a complete loss about why it’s happening. Any ideas from the community about what might be the issue here?
In the meantime I’ve worked around it with
if get(ENV, "CI", nothing) == "true"
@test_throws ArgumentError foo(; x=1)
else
@test_throws MethodError foo(; x=1)
end
and while it’s nice and explicit about the source of the problem (i.e. the CI environment), it’s not really a long-term solution for the problem.
Thanks in advance and best wishes