Skip to content

Commit b46f779

Browse files
committed
warn with "no matching tests" only when no match in any module
The message was annoying and distracting in particular when calling `retest()` without any explicitly passed module.
1 parent 519dd28 commit b46f779

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/ReTest.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,9 @@ function retest(args::Union{Module,AbstractString,Regex}...;
303303
root = Testset.ReTestSet("", "Overall", true)
304304

305305
tests_descs_hasbrokens = fetchtests.(modules, regex, verbose, overall)
306+
isempty(tests_descs_hasbrokens) &&
307+
throw(ArgumentError("no modules using ReTest could be found and none were passed"))
308+
306309
alltests = first.(tests_descs_hasbrokens)
307310
descwidth = max(textwidth(root.description),
308311
maximum(x->x[2], tests_descs_hasbrokens))
@@ -311,16 +314,12 @@ function retest(args::Union{Module,AbstractString,Regex}...;
311314

312315
emptymods = findall(isempty, alltests)
313316
nmodules = length(modules) - length(emptymods)
314-
if !isempty(emptymods)
317+
if nmodules == 0
315318
plural = length(emptymods) > 1 ? "s" : ""
316319
print("No matching tests for module$plural ")
317320
join(stdout, string.(getindex.((modules,), emptymods)), ", ", " and ")
318321
println('.')
319-
if nmodules > 0
320-
println()
321-
else
322-
return
323-
end
322+
return
324323
end
325324

326325
for imod in eachindex(modules)

0 commit comments

Comments
 (0)