Skip to content

Commit

Permalink
Merge pull request #661 from JuliaSymbolics/SafeTestsets
Browse files Browse the repository at this point in the history
Enhance Reproducibility and Isolation with SafeTestsets
  • Loading branch information
bowenszhu authored Oct 17, 2024
2 parents 522fae3 + 3ca3c93 commit ed27d82
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 38 deletions.
3 changes: 2 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
ReferenceTests = "324d217c-45ce-50fc-942e-d289b448e8cf"
ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[targets]
test = ["BenchmarkTools", "Documenter", "LabelledArrays", "Pkg", "PkgBenchmark", "Random", "ReferenceTests", "ReverseDiff", "Test", "Zygote"]
test = ["BenchmarkTools", "Documenter", "LabelledArrays", "Pkg", "PkgBenchmark", "Random", "ReferenceTests", "ReverseDiff", "SafeTestsets", "Test", "Zygote"]
4 changes: 3 additions & 1 deletion test/basics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ using SymbolicUtils: Symbolic, Sym, FnType, Term, Add, Mul, Pow, symtype, operat
using SymbolicUtils
using IfElse: ifelse
using Setfield
using Test
using Test, ReferenceTests

include("utils.jl")

@testset "@syms" begin
let
Expand Down
10 changes: 10 additions & 0 deletions test/doctest.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Documenter, SymbolicUtils

DocMeta.setdocmeta!(
SymbolicUtils,
:DocTestSetup,
:(using SymbolicUtils);
recursive=true
)

doctest(SymbolicUtils)
5 changes: 2 additions & 3 deletions test/fuzzlib.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using SymbolicUtils
using SymbolicUtils: Term
using SymbolicUtils: Term, showraw, Symbolic, issym
using SpecialFunctions
using Test
import IfElse: ifelse
import IfElse

using SymbolicUtils: showraw, Symbolic
using NaNMath

function rand_input(T)
if T == Bool
Expand Down
3 changes: 2 additions & 1 deletion test/order.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Test
using Combinatorics
using SymbolicUtils: <ₑ, arguments
using SymbolicUtils
using SymbolicUtils: <ₑ, arguments, Term
SymbolicUtils.show_simplified[] = false

@syms a b c
Expand Down
2 changes: 2 additions & 0 deletions test/polyform.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using SymbolicUtils: PolyForm, Term, symtype
using Test, SymbolicUtils

include("utils.jl")

@testset "div and polyform" begin
@syms x y z
@test_skip repr(PolyForm(x-y)) == "-y + x"
Expand Down
4 changes: 4 additions & 0 deletions test/rewrite.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
using SymbolicUtils

include("utils.jl")

@syms a b c

@testset "Equality" begin
Expand Down
3 changes: 3 additions & 0 deletions test/rulesets.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using Random: shuffle, seed!
using SymbolicUtils
using SymbolicUtils: getdepth, Rewriters, Term

include("utils.jl")

@testset "Chain, Postwalk and Fixpoint" begin
@syms w z α::Real β::Real

Expand Down
50 changes: 18 additions & 32 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,34 +1,20 @@
using Documenter
using Pkg
using Test
using SymbolicUtils
using ReferenceTests
import IfElse: ifelse
using Pkg, Test, SafeTestsets

DocMeta.setdocmeta!(
SymbolicUtils,
:DocTestSetup,
:(using SymbolicUtils);
recursive=true
)

doctest(SymbolicUtils)
SymbolicUtils.show_simplified[] = false

include("utils.jl")

if haskey(ENV, "SU_BENCHMARK_ONLY")
include("benchmark.jl")
else
include("basics.jl")
include("order.jl")
include("polyform.jl")
include("rewrite.jl")
include("rulesets.jl")
include("code.jl")
include("cse.jl")
include("interface.jl")
# Disabled until https://github.com/JuliaMath/SpecialFunctions.jl/issues/446 is fixed
include("fuzz.jl")
include("adjoints.jl")
@testset begin
if haskey(ENV, "SU_BENCHMARK_ONLY")
@safetestset "Benchmark" begin include("benchmark.jl") end
else
@safetestset "Doc" begin include("doctest.jl") end
@safetestset "Basics" begin include("basics.jl") end
@safetestset "Order" begin include("order.jl") end
@safetestset "PolyForm" begin include("polyform.jl") end
@safetestset "Rewrite" begin include("rewrite.jl") end
@safetestset "Rulesets" begin include("rulesets.jl") end
@safetestset "Code" begin include("code.jl") end
@safetestset "CSE" begin include("cse.jl") end
@safetestset "Interface" begin include("interface.jl") end
# Disabled until https://github.com/JuliaMath/SpecialFunctions.jl/issues/446 is fixed
@safetestset "Fuzz" begin include("fuzz.jl") end
@safetestset "Adjoints" begin include("adjoints.jl") end
end
end

0 comments on commit ed27d82

Please sign in to comment.