From f3a942b023c469f0cdb253008a9607cc1c29f119 Mon Sep 17 00:00:00 2001 From: Bryan Kaperick Date: Wed, 7 Aug 2024 12:31:07 +0200 Subject: [PATCH] Fix test filter logic - format more like QuantumClifford PR --- test/runtests.jl | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index d1671316..ad598b72 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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) \ No newline at end of file