Skip to content

Commit

Permalink
Fix test filter logic - format more like QuantumClifford PR
Browse files Browse the repository at this point in the history
  • Loading branch information
BKaperick committed Aug 20, 2024
1 parent b466b06 commit f3a942b
Showing 1 changed file with 12 additions and 23 deletions.
35 changes: 12 additions & 23 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
using QuantumSavory
using TestItemRunner

function doset(tag)
if length(ARGS) == 0
return true
end
for a in ARGS
if occursin(lowercase(a), lowercase(String(tag)))
return true
end
end
if get(ENV,"JET_TEST","")=="true" && tag == :jet
return true
end
if get(ENV,"QUANTUMSAVORY_PLOT_TEST","")=="true"
if tag in [:plotting_gl, :plotting_cairo]
return true
end
if VERSION >= v"1.9" && tag == :doctests
return true
function testfilter(tags)
exclude = Symbol[]
# Only do the plotting tests if the ENV variable `QUANTUMSAVORY_PLOT_TEST` is set
if get(ENV,"QUANTUMSAVORY_PLOT_TEST","")!="true"
push!(exclude, :plotting_cairo)
push!(exclude, :plotting_gl)
if VERSION >= v"1.9"
push!(exclude, :doctests)
end
end
if tag in [:examples, :aqua]
return true
if get(ENV,"JET_TEST","")!="true"
push!(exclude, :jet)
end

return false
return all(!in(exclude), tags)
end

println("Starting tests with $(Threads.nthreads()) threads out of `Sys.CPU_THREADS = $(Sys.CPU_THREADS)`...")

@run_package_tests filter=ti->any([doset(tag) for tag in ti.tags])
@run_package_tests filter=ti->testfilter(ti.tags)

0 comments on commit f3a942b

Please sign in to comment.