Skip to content

Commit

Permalink
Test Project.toml structure and suppressor (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdvos authored Dec 8, 2024
1 parent 419618f commit 478dbf0
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 30 deletions.
11 changes: 0 additions & 11 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,11 @@ Preferences = "21216c6a-2e73-6563-6e65-726566657250"
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"

[compat]
Aqua = "0.8.9"
DocStringExtensions = "0.9.3"
Git = "1.3.1"
Git_jll = "2.46.2"
LibGit2 = "1.10"
PkgSkeleton = "1.3.1"
Preferences = "1.4.3"
SafeTestsets = "0.1"
Suppressor = "0.2.8"
Test = "1.10"
julia = "1.10"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Aqua", "Test", "SafeTestsets"]
13 changes: 0 additions & 13 deletions templates/project/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,4 @@ authors = ["ITensor developers <support@itensor.org> and contributors"]
version = "0.1.0"

[compat]
Aqua = "0.8.9"
SafeTestsets = "0.1"
Suppressor = "0.2"
Test = "1.10"
julia = "1.10"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"

[targets]
test = ["Aqua", "Test", "Suppressor", "SafeTestsets"]
11 changes: 11 additions & 0 deletions templates/test/test/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[deps]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
Aqua = "0.8.9"
SafeTestsets = "0.1"
Suppressor = "0.2"
Test = "1.10"
14 changes: 11 additions & 3 deletions templates/test/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using SafeTestsets: @safetestset
using Suppressor: @suppress
using Suppressor: Suppressor

# check for filtered groups
# either via `--group=ALL` or through ENV["GROUP"]
Expand Down Expand Up @@ -42,8 +42,16 @@ end
# test examples
examplepath = joinpath(@__DIR__, "..", "examples")
for file in filter(endswith(".jl"), readdir(examplepath; join=true))
@suppress @eval @safetestset $file begin
include($file)
filename = basename(file)
@eval begin
@safetestset $filename begin
$(Expr(
:macrocall,
GlobalRef(Suppressor, Symbol("@suppress")),
LineNumberNode(@__LINE__, @__FILE__),
:(include($file)),
))
end
end
end
end
11 changes: 11 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[deps]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
Suppressor = "fd094767-a336-5f1f-9728-57cf17d0bbfb"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[compat]
Aqua = "0.8.9"
SafeTestsets = "0.1"
Suppressor = "0.2"
Test = "1.10"
14 changes: 11 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using SafeTestsets: @safetestset
using Suppressor: @suppress
using Suppressor: Suppressor

# check for filtered groups
# either via `--group=ALL` or through ENV["GROUP"]
Expand Down Expand Up @@ -42,8 +42,16 @@ end
# test examples
examplepath = joinpath(@__DIR__, "..", "examples")
for file in filter(endswith(".jl"), readdir(examplepath; join=true))
@suppress @eval @safetestset $file begin
include($file)
filename = basename(file)
@eval begin
@safetestset $filename begin
$(Expr(
:macrocall,
GlobalRef(Suppressor, Symbol("@suppress")),
LineNumberNode(@__LINE__, @__FILE__),
:(include($file)),
))
end
end
end
end

0 comments on commit 478dbf0

Please sign in to comment.