Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP add dryrun for printing out what test would be run #176

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/ReTestItems.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions src/testcontext.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
###
Expand Down
Loading