Skip to content

Commit afd15c3

Browse files
authored
Fix testing subdirs (#261)
1 parent 972cb70 commit afd15c3

File tree

5 files changed

+16
-184
lines changed

5 files changed

+16
-184
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ITensorNetworks"
22
uuid = "2919e153-833c-4bdc-8836-1ea460a35fc7"
33
authors = ["Matthew Fishman <[email protected]>, Joseph Tindall <[email protected]> and contributors"]
4-
version = "0.15.1"
4+
version = "0.15.2"
55

66
[deps]
77
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"

src/ITensorNetworks.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ include("solvers/operator_map.jl")
6565
include("solvers/abstract_problem.jl")
6666
include("solvers/eigsolve.jl")
6767
include("solvers/applyexp.jl")
68-
include("solvers/fitting.jl")
6968

7069
include("apply.jl")
7170
include("inner.jl")

src/solvers/fitting.jl

Lines changed: 0 additions & 123 deletions
This file was deleted.

test/runtests.jl

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,42 @@ const pat = r"(?:--group=)(\w+)"
77
arg_id = findfirst(contains(pat), ARGS)
88
const GROUP = uppercase(
99
if isnothing(arg_id)
10-
get(ENV, "GROUP", "ALL")
10+
arg = get(ENV, "GROUP", "ALL")
11+
# For some reason `ENV["GROUP"]` is set to `""`
12+
# when running via GitHub Actions, so handle that case:
13+
arg == "" ? "ALL" : arg
1114
else
1215
only(match(pat, ARGS[arg_id]).captures)
1316
end,
1417
)
1518

1619
"match files of the form `test_*.jl`, but exclude `*setup*.jl`"
17-
function istestfile(fn)
20+
function istestfile(path)
21+
fn = basename(path)
1822
return endswith(fn, ".jl") && startswith(basename(fn), "test_") && !contains(fn, "setup")
1923
end
2024
"match files of the form `*.jl`, but exclude `*_notest.jl` and `*setup*.jl`"
21-
function isexamplefile(fn)
25+
function isexamplefile(path)
26+
fn = basename(path)
2227
return endswith(fn, ".jl") && !endswith(fn, "_notest.jl") && !contains(fn, "setup")
2328
end
2429

2530
@time begin
2631
# tests in groups based on folder structure
27-
for testgroup in filter(f -> isdir(joinpath(@__DIR__, f)), readdir(@__DIR__))
28-
if GROUP == "ALL" || GROUP == uppercase(testgroup)
29-
groupdir = joinpath(@__DIR__, testgroup)
30-
for file in filter(istestfile, readdir(groupdir))
31-
filename = joinpath(groupdir, file)
32-
@eval @safetestset $file begin
32+
for testgroup in filter(isdir, readdir(@__DIR__; join = true))
33+
if GROUP == "ALL" || GROUP == uppercase(basename(testgroup))
34+
for filename in filter(istestfile, readdir(testgroup; join = true))
35+
@eval @safetestset $(basename(filename)) begin
3336
include($filename)
3437
end
3538
end
3639
end
3740
end
3841

3942
# single files in top folder
40-
for file in filter(istestfile, readdir(@__DIR__))
41-
(file == basename(@__FILE__)) && continue # exclude this file to avoid infinite recursion
42-
@eval @safetestset $file begin
43+
for file in filter(istestfile, readdir(@__DIR__; join = true))
44+
(basename(file) == basename(@__FILE__)) && continue # exclude this file to avoid infinite recursion
45+
@eval @safetestset $(basename(file)) begin
4346
include($file)
4447
end
4548
end

test/solvers/test_fitting.jl

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)