I am going through a weird issue when writing a testset for a part of RigorousInvariantMeasures.jl that uses Symbolics.jl.
I start the testset by using Symbolics, then call @variables z
and when I run the tests Julia complains saying that @variables is not defined.
Minimal problematic code:
@testset "Test Symbolic code" begin
using Symbolics
@variables z
end
Probably because it’s trying to expand the macro before anything happens i.e. at compile time, but the macro is not loaded yet.
I understand, it makes sense, thank you.
Do you have any idea on how I could make this code work?
I tried by calling
Symbolics.@variables z
but, supporting your theses, then Julia states that Symbolics is unknown, i.e.,
it seems it tries to run the macro before using the package.
Just put using Symbolics
outside of the test set - macros will always be expanded before anything is run.
If you want to make using Symbolics
only apply in that test set, look into SafeTestsets.jl
1 Like