Skip to content

Commit

Permalink
Revert "Add functionality for loading setup code"
Browse files Browse the repository at this point in the history
This reverts commit 5ed825c.
  • Loading branch information
lkdvos committed Dec 9, 2024
1 parent 5ed825c commit 95cddfa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 37 deletions.
19 changes: 5 additions & 14 deletions templates/test/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ const GROUP = uppercase(
end,
)

# define paths
testdir = @__DIR__
testsetupdir = joinpath(testdir, "setup/")
exampledir = joinpath(@__DIR__, "..", "examples/")
examplesetupdir = joinpath(exampledir, "setup/")

# Load setup code into path, so `using SetupModule` works
isdir(testsetupdir) && push!(LOAD_PATH, testsetupdir)
isdir(examplesetupdir) && push!(LOAD_PATH, examplesetupdir)

function istestfile(filename)
return isfile(filename) &&
endswith(filename, ".jl") &&
Expand All @@ -31,9 +21,9 @@ end

@time begin
# tests in groups based on folder structure
for testgroup in filter(isdir, readdir(testdir))
for testgroup in filter(isdir, readdir(@__DIR__))
if GROUP == "ALL" || GROUP == uppercase(testgroup)
for file in filter(istestfile, readdir(joinpath(testdir, testgroup); join=true))
for file in filter(istestfile, readdir(joinpath(@__DIR__, testgroup); join=true))
@eval @safetestset $file begin
include($file)
end
Expand All @@ -42,15 +32,16 @@ end
end

# single files in top folder
for file in filter(istestfile, readdir(testdir))
for file in filter(istestfile, readdir(@__DIR__))
(file == basename(@__FILE__)) && continue
@eval @safetestset $file begin
include($file)
end
end

# test examples
for file in filter(endswith(".jl"), readdir(exampledir; join=true))
examplepath = joinpath(@__DIR__, "..", "examples")
for file in filter(endswith(".jl"), readdir(examplepath; join=true))
filename = basename(file)
@eval begin
@safetestset $filename begin
Expand Down
19 changes: 5 additions & 14 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ const GROUP = uppercase(
end,
)

# define paths
testdir = @__DIR__
testsetupdir = joinpath(testdir, "setup/")
exampledir = joinpath(@__DIR__, "..", "examples/")
examplesetupdir = joinpath(exampledir, "setup/")

# Load setup code into path, so `using SetupModule` works
isdir(testsetupdir) && push!(LOAD_PATH, testsetupdir)
isdir(examplesetupdir) && push!(LOAD_PATH, examplesetupdir)

function istestfile(filename)
return isfile(filename) &&
endswith(filename, ".jl") &&
Expand All @@ -31,9 +21,9 @@ end

@time begin
# tests in groups based on folder structure
for testgroup in filter(isdir, readdir(testdir))
for testgroup in filter(isdir, readdir(@__DIR__))
if GROUP == "ALL" || GROUP == uppercase(testgroup)
for file in filter(istestfile, readdir(joinpath(testdir, testgroup); join=true))
for file in filter(istestfile, readdir(joinpath(@__DIR__, testgroup); join=true))
@eval @safetestset $file begin
include($file)
end
Expand All @@ -42,15 +32,16 @@ end
end

# single files in top folder
for file in filter(istestfile, readdir(testdir))
for file in filter(istestfile, readdir(@__DIR__))
(file == basename(@__FILE__)) && continue
@eval @safetestset $file begin
include($file)
end
end

# test examples
for file in filter(endswith(".jl"), readdir(exampledir; join=true))
examplepath = joinpath(@__DIR__, "..", "examples")
for file in filter(endswith(".jl"), readdir(examplepath; join=true))
filename = basename(file)
@eval begin
@safetestset $filename begin
Expand Down
5 changes: 0 additions & 5 deletions test/setup/Setup.jl

This file was deleted.

4 changes: 0 additions & 4 deletions test/test_setupmodule.jl

This file was deleted.

0 comments on commit 95cddfa

Please sign in to comment.