Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Manifest.toml
/docs/build/
*.cov
8 changes: 8 additions & 0 deletions src/ParallelTestRunner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,16 @@ end
Filter tests in `testsuite` based on command-line arguments in `args`.

Returns `true` if additional filtering may be done by the caller, `false` otherwise.

When `--list` is requested, the full `testsuite` is preserved and `false` is
returned so that callers skip any conditional filtering of their own: listing
should show every available test, not just the ones that would run by default.
"""
function filter_tests!(testsuite, args::ParsedArgs)
# when only listing tests, keep the full catalog and let the caller skip its
# own filtering, so that every available test is shown
args.list !== nothing && return false

# the user did not request specific tests, so let the caller do its own filtering
isempty(args.positionals) && return true

Expand Down
14 changes: 14 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,20 @@ end
@test filter_tests!(testsuite, args) == false
@test isempty(testsuite)
end

@testset "listing preserves all tests" begin
testsuite = Dict("a" => :(), "b" => :(), "c" => :())
args = parse_args(["--list"])
@test filter_tests!(testsuite, args) == false
@test length(testsuite) == 3
end

@testset "listing ignores positional filters" begin
testsuite = Dict("a" => :(), "b" => :())
args = parse_args(["--list", "a"])
@test filter_tests!(testsuite, args) == false
@test length(testsuite) == 2
end
end

@testset "find_tests edge cases" begin
Expand Down
Loading