JuliaTesting / SimpleMock.jl

A basic mocking module
https://juliatesting.github.io/SimpleMock.jl
MIT License
21 stars 4 forks source link

Test fails on Julia 1.4 and master (due to Cassette bug?) #9

Closed KristofferC closed 4 years ago

KristofferC commented 4 years ago

Seems to be a Cassette bug though (https://github.com/jrevels/Cassette.jl/issues/130#issuecomment-570637431)? Posting here as well for posterity.

Keyword arguments are discarded when recursing: Log Test Failed at /home/pkgeval/.julia/packages/SimpleMock/M6rZE/test/mock_fun.jl:169
  Expression: baz(; foo = :baz)
  Log Pattern: (:warn, "Discarding keyword arguments")
  Captured Logs: 

Stacktrace:
 [1] record at /workspace/srcdir/usr/share/julia/stdlib/v1.4/Test/src/logging.jl:89 [inlined]
 [2] overdub(::Cassette.Context{nametype(##578),SimpleMock.Metadata{true},Nothing,Cassette.var"##PassType#455",Nothing,Nothing}, ::typeof(Test.record), ::Test.DefaultTestSet, ::Test.LogTestFailure) at /home/pkgeval/.julia/packages/Cassette/YCOeN/src/overdub.jl:0
 [3] #55 at /home/pkgeval/.julia/packages/SimpleMock/M6rZE/test/mock_fun.jl:169 [inlined]
 [4] overdub(::Cassette.Context{nametype(##578),SimpleMock.Metadata{true},Nothing,Cassette.var"##PassType#455",Nothing,Nothing}, ::var"#55#77", ::Mock{SimpleMock.var"#15#17"{SimpleMock.var"#15#16#18"}}) at /home/pkgeval/.julia/packages/Cassette/YCOeN/src/overdub.jl:0
 [5] invokelatest(::Any, ::Any, ::Keyword arguments are discarded when recursing: Error During Test at /home/pkgeval/.julia/packages/SimpleMock/M6rZE/test/mock_fun.jl:165
  Got exception outside of a @test
  type DataType has no field var <------------------------------
  Stacktrace:
   [1] getproperty at ./Base.jl:28 [inlined]
   [2] call at /home/pkgeval/.julia/packages/Cassette/YCOeN/src/context.jl:447 [inlined]
   [3] fallback at /home/pkgeval/.julia/packages/Cassette/YCOeN/src/context.jl:445 [inlined]
   [4] overdub at /home/pkgeval/.julia/packages/Cassette/YCOeN/src/context.jl:271 [inlined]
   [5] show at ./show.jl:498 [inlined]
   [6] overdub(::Cassette.Context{nametype(##578),SimpleMock.Metadata{true},Nothing,Cassette.var"##PassType#455",Nothing,Nothing}, ::typeof(show), ::IOContext{Base.PipeEndpoint}, ::Type{Vararg{Any,N} where N}) at /home/pkgeval/.julia/packages/Cassette/YCOeN/src/overdub.jl:0
   [7] show at ./show.jl:511 [inlined]
   [8] overdub(::Cassette.Context{nametype(##578),SimpleMock.Metadata{true},Nothing,Cassette.var"##PassType#455",Nothing,Nothing}, ::typeof(show), ::IOContext{Base.PipeEndpoint}, ::Type{Vararg{Any,N} where N}) at /home/pkgeval/.julia/packages/Cassette/YCOeN/src/overdub.jl:0
   [9] print at ./strings/io.jl:35 [inlined]
kmsquire commented 4 years ago

I just ran into this.

christopher-dG commented 4 years ago

Mind sharing the code that caused it?

kmsquire commented 4 years ago

Unfortunately, I can't share that code, but I'll see if I can come up with a minimal example.

christopher-dG commented 4 years ago

Fixed by https://github.com/jrevels/Cassette.jl/pull/172 🎉