Skip to content

Unable to use @safetestset inside loop #18

@densmojd

Description

@densmojd

Here's a MWE:

tests = ["test1.jl"]
for test in tests
    @testset "$test" begin include(test) end
end

works fine. Replacing @testset with @safetestset gives the following error:

ERROR: LoadError: ArgumentError: Use `@safetestset` like the following:
@safetestset "Benchmark Tests" begin include("benchmark_tests.jl") end
@safetestset BenchmarkTests = "Benchmark Tests" begin include("benchmark_tests.jl") end

Removing the string interpolation (to avoid #4),

tests = ["test1.jl"]
for test in tests
    @safetestset "test_name" begin include(test) end
end

gives the following error:

Got exception outside of a @test
  UndefVarError: `test` not defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions