You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to enable use of LocalCoverage.jl with subsets of tests by providing three optional arguments to generate_coverage() (and to any functions that call generate_coverage()):
test_args::String which is simply passed along to Pkg.test()
folder_list::Vector{String} a list of paths to directories for `process_folder(), and
file_list::Vector{String} a list of paths to files for process_file()
generate_coverage() would then be changed:
functiongenerate_coverage(pkg =nothing; run_test =true, test_args ="", folder_list = ["src"], file_list = [])
if run_test
# passing `test_args` to `Pkg.test()`isnothing(pkg) ? Pkg.test(; coverage =true, test_args = test_args) : Pkg.test(pkg; coverage =true, test_args = test_args)
end
package_dir =pkgdir(pkg)
cd(package_dir) do# initialize empty vector of coverage data
coverage =Vector{CoverageTools.FileCoverage}()
# process folders (same as default if `folder_list` isn't provided)for f in folder_list
append!(coverage, process_folder(f))
end# process individual filesfor f in file_list
push!(coverage, process_file(f))
endmkpath(COVDIR)
tracefile =joinpath(COVDIR, LCOVINFO)
CoverageTools.LCOV.writefile(tracefile, coverage)
CoverageTools.clean_folder("./")
eval_coverage_metrics(coverage, package_dir)
endend
Motivation
I have a project where testing is compartmentalized, using test_args, based on which files changed. Using Coverage.jl I can then use process_folder() and process_file() on the different directories/files that were included in the test so that coverage is accurate for the tests run.
I'd like to enable use of
LocalCoverage.jl
with subsets of tests by providing three optional arguments togenerate_coverage()
(and to any functions that callgenerate_coverage()
):test_args::String
which is simply passed along toPkg.test()
folder_list::Vector{String}
a list of paths to directories for `process_folder(), andfile_list::Vector{String}
a list of paths to files forprocess_file()
generate_coverage()
would then be changed:Motivation
I have a project where testing is compartmentalized, using
test_args
, based on which files changed. UsingCoverage.jl
I can then useprocess_folder()
andprocess_file()
on the different directories/files that were included in the test so that coverage is accurate for the tests run.I'd like to be able to achieve the same effect with
LocalCoverage.jl
I'm happy to PR this.
The text was updated successfully, but these errors were encountered: