Skip to content

Commit 40af68d

Browse files
authored
Make --list always list all tests, even filtered ones. (#136)
1 parent 726776f commit 40af68d

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
Manifest.toml
22
/docs/build/
3+
*.cov

src/ParallelTestRunner.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,8 +761,16 @@ end
761761
Filter tests in `testsuite` based on command-line arguments in `args`.
762762
763763
Returns `true` if additional filtering may be done by the caller, `false` otherwise.
764+
765+
When `--list` is requested, the full `testsuite` is preserved and `false` is
766+
returned so that callers skip any conditional filtering of their own: listing
767+
should show every available test, not just the ones that would run by default.
764768
"""
765769
function filter_tests!(testsuite, args::ParsedArgs)
770+
# when only listing tests, keep the full catalog and let the caller skip its
771+
# own filtering, so that every available test is shown
772+
args.list !== nothing && return false
773+
766774
# the user did not request specific tests, so let the caller do its own filtering
767775
isempty(args.positionals) && return true
768776

test/runtests.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,20 @@ end
713713
@test filter_tests!(testsuite, args) == false
714714
@test isempty(testsuite)
715715
end
716+
717+
@testset "listing preserves all tests" begin
718+
testsuite = Dict("a" => :(), "b" => :(), "c" => :())
719+
args = parse_args(["--list"])
720+
@test filter_tests!(testsuite, args) == false
721+
@test length(testsuite) == 3
722+
end
723+
724+
@testset "listing ignores positional filters" begin
725+
testsuite = Dict("a" => :(), "b" => :())
726+
args = parse_args(["--list", "a"])
727+
@test filter_tests!(testsuite, args) == false
728+
@test length(testsuite) == 2
729+
end
716730
end
717731

718732
@testset "find_tests edge cases" begin

0 commit comments

Comments
 (0)