Skip to content
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

Address testthat deprecation warnings + drop mockery #589

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
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: 0 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ Suggests:
xml2 (>= 1.0.0),
parallel,
memoise,
mockery,
covr,
box (>= 1.2.0)
License: MIT + file LICENSE
Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ export(to_sonarqube)
export(value)
export(zero_coverage)
import(methods)
importFrom(httr,RETRY)
importFrom(httr,content)
importFrom(httr,upload_file)
Comment on lines +35 to +37
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

importFrom(stats,aggregate)
importFrom(stats,na.omit)
importFrom(stats,na.pass)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# covr (development version)

* covr now uses `testthat::with_mocked_bindings()` for its internal testing (@olivroy, #595).

* Fix R CMD check NOTE: non-API calls to SET_BODY, SET_CLOENV, SET_FORMALS (@t-kalinowski, #587)

* Fix a bug preventing `package_coverage()` from running tests when `install_path` is set to a relative path (@gergness, #517, #548).
Expand Down
12 changes: 6 additions & 6 deletions R/codecov.R
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,12 @@ codecov <- function(...,

coverage_json <- to_codecov(coverage)

httr::content(httr::RETRY("POST",
url = codecov_url,
query = codecov_query,
body = coverage_json,
encode = "json",
httr::config(http_version = curl_http_1_1())))
content(RETRY("POST",
url = codecov_url,
query = codecov_query,
body = coverage_json,
encode = "json",
httr::config(http_version = curl_http_1_1())))
}

curl_http_1_1 <- function() {
Expand Down
4 changes: 4 additions & 0 deletions R/compiled.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ parse_gcov <- function(file, package_path = "") {
line_coverages(source_file, matches, values, functions)
}

# for mocking
readLines <- NULL
file.exists <- NULL

clean_gcov <- function(path) {
src_dir <- file.path(path, "src")

Expand Down
6 changes: 3 additions & 3 deletions R/coveralls.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ coveralls <- function(..., coverage = NULL,
coverage_json <- to_coveralls(coverage,
repo_token = repo_token, service_name = service)

result <- httr::RETRY("POST", url = coveralls_url,
body = list(json_file = httr::upload_file(to_file(coverage_json))))
result <- RETRY("POST", url = coveralls_url,
body = list(json_file = upload_file(to_file(coverage_json))))

content <- httr::content(result)
content <- content(result)
if (isTRUE(content$error)) {
stop("Failed to upload coverage data. Reply by Coveralls: ", content$message)
}
Expand Down
1 change: 1 addition & 0 deletions R/covr.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
#' @import methods
#' @importFrom stats aggregate na.omit na.pass setNames
#' @importFrom utils capture.output getSrcFilename relist str head
#' @importFrom httr content RETRY upload_file
NULL

the <- new.env(parent = emptyenv())
Expand Down
Loading
Loading