-
Notifications
You must be signed in to change notification settings - Fork 25
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
Coverage for failing tests #58
Open
briederer
wants to merge
4
commits into
JuliaCI:master
Choose a base branch
from
briederer:failing-tests
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,18 +18,39 @@ function test_coverage(pkg; | |
test_args = [""], | ||
folder_list = ["src"], | ||
file_list = [], | ||
css = nothing) | ||
css = nothing, | ||
should_throw = false) | ||
@info "Testing coverage for $pkg" test_args folder_list file_list | ||
clean_coverage(pkg) | ||
@test isdir(LocalCoverage.pkgdir(pkg)) | ||
lcovtrace = joinpath(covdir, "lcov.info") | ||
@test !isfile(lcovtrace) | ||
|
||
cov = generate_coverage(pkg; | ||
run_test = run_test, | ||
test_args = test_args, | ||
folder_list = folder_list, | ||
file_list = file_list) | ||
if should_throw | ||
@test_throws Pkg.Types.PkgError generate_coverage(pkg; | ||
run_test=run_test, | ||
test_args=test_args, | ||
folder_list=folder_list, | ||
file_list=file_list) | ||
else | ||
cov = generate_coverage(pkg; | ||
run_test = run_test, | ||
test_args = test_args, | ||
folder_list = folder_list, | ||
file_list = file_list) | ||
|
||
buffer = IOBuffer() | ||
show(buffer, cov) | ||
table = String(take!(buffer)) | ||
println(table) | ||
@test !isnothing(match(table_header, table)) | ||
@test !isnothing(match(table_line, table)) | ||
@test !isnothing(match(table_footer, table)) | ||
|
||
@info "Printing coverage information for visual debugging" | ||
show(stdout, cov) | ||
show(IOContext(stdout, :print_gaps => true), cov) | ||
end | ||
|
||
xmltrace = joinpath(covdir,"lcov.xml") | ||
write_lcov_to_xml(xmltrace, lcovtrace) | ||
|
@@ -40,14 +61,6 @@ function test_coverage(pkg; | |
@test startswith(doctype, "<!DOCTYPE coverage") | ||
end | ||
|
||
buffer = IOBuffer() | ||
show(buffer, cov) | ||
table = String(take!(buffer)) | ||
println(table) | ||
@test !isnothing(match(table_header, table)) | ||
@test !isnothing(match(table_line, table)) | ||
@test !isnothing(match(table_footer, table)) | ||
|
||
if !isnothing(Sys.which("genhtml")) | ||
mktempdir() do dir | ||
html_coverage(pkg, dir = dir, css = css) | ||
|
@@ -59,10 +72,6 @@ function test_coverage(pkg; | |
|
||
@test isfile(lcovtrace) | ||
rm(covdir, recursive = true) | ||
|
||
@info "Printing coverage information for visual debugging" | ||
show(stdout, cov) | ||
show(IOContext(stdout, :print_gaps => true), cov) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why was this removed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as before. |
||
end | ||
|
||
@testset verbose = true "Testing coverage with" begin | ||
|
@@ -93,6 +102,10 @@ end | |
@test_throws TypeError test_coverage("DummyPackage", css=1) | ||
test_coverage("DummyPackage", css=joinpath(dirname(@__FILE__), "dummy.css")) | ||
end | ||
|
||
@testset "failing tests" begin | ||
test_coverage("DummyPackage"; test_args = ["testset 3"], should_throw = true) | ||
end | ||
end | ||
|
||
@test LocalCoverage.find_gaps([nothing, 0, 0, 0, 2, 3, 0, nothing, 0, 3, 0, 6, 2]) == | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was not removed. It was moved up to line 42 and beyond.
The reason is, that for the new test case of a failing test in the dummy package no coverage is returned, but instead throws an error. Therefore all the tests using
cov
cannot be processed, after the test has thrown.So there is no change in the tests for the old ones, but an adaption for the test of the new feature.