diff --git a/src/ReTestItems.jl b/src/ReTestItems.jl index e4eeeb5b..58c1d44d 100644 --- a/src/ReTestItems.jl +++ b/src/ReTestItems.jl @@ -332,8 +332,14 @@ function _runtests_in_current_env( testitems, _ = include_testfiles!(proj_name, projectfile, paths, ti_filter, verbose_results, report) ntestitems = length(testitems.testitems) @debugv 1 "Done including tests in $paths" - @info "Finished scanning for test items in $(round(time() - inc_time, digits=2)) seconds." * - " Scheduling $ntestitems tests on pid $(Libc.getpid())" * + @info "Finished scanning for test items in $(round(time() - inc_time, digits=2)) seconds." + # TODO: make this a keyword to `runtests` that gets passed to `_runtests_in_current_env` + dryrun = parse(Bool, get(ENV, "RETESTITEMS_DRYRUN", "false"))::Bool + if dryrun + print_testitems(testitems) + return nothing + end + @info "Scheduling $ntestitems tests on pid $(Libc.getpid())" * (nworkers == 0 ? "" : " with $nworkers worker processes and $nworker_threads threads per worker.") try if nworkers == 0 diff --git a/src/testcontext.jl b/src/testcontext.jl index 0cf68055..75f040ff 100644 --- a/src/testcontext.jl +++ b/src/testcontext.jl @@ -94,6 +94,29 @@ end TestItems(graph) = TestItems(graph, TestItem[], 0) +function print_testitems(tis::TestItems) + ntestitems = length(tis.testitems) + if ntestitems == 0 + printstyled("No test items found\n"; bold=true) + return nothing + end + plural = ntestitems == 1 ? "" : "s" + printstyled("$ntestitems test item$plural found:\n"; bold=true) + print_testitems(tis.graph) +end +function print_testitems(dir::DirNode, indent::Int=0) + println(" "^indent, dir.path) + for child in dir.children + print_testitems(child, indent + 1) + end +end +function print_testitems(file::FileNode, indent::Int=0) + println(" "^indent, file.path) + for ti in file.testitems + printstyled(" "^(indent+1), ti.name, "\n"; bold=true) + end +end + ### ### record results ###