Skip to content

Commit

Permalink
Merge branch 'develop' into fix_warnings_mining
Browse files Browse the repository at this point in the history
  • Loading branch information
infotroph authored Oct 5, 2023
2 parents eb25f94 + 341bf6c commit 8ecd9fe
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion book_source/_bookdown.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rmd_subdir: true
edit: https://github.com/tonygardella/pecan/edit/release/vtonydoc/book_source/%s
edit: https://github.com/PecanProject/pecan/edit/develop/book_source/%s
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
library(testthat)
library(PEcAn.DB)

test_download_AmerifluxLBL <- function(start_date, end_date, sitename, lat.in, lon.in) {
# putting logger to debug mode
Expand All @@ -7,13 +8,13 @@ test_download_AmerifluxLBL <- function(start_date, end_date, sitename, lat.in, l
PEcAn.logger::logger.setLevel("DEBUG")

# mocking functions
mockery::stub(PEcAn.DB::convert_input, 'dbfile.input.check', data.frame())
mockery::stub(PEcAn.DB::convert_input, 'db.query', data.frame(id = 1))
mockery::stub(convert_input, 'dbfile.input.check', data.frame())
mockery::stub(convert_input, 'db.query', data.frame(id = 1))

withr::with_dir(tempdir(), {
tmpdir <- getwd()
# calling download function
res <- PEcAn.DB::convert_input(
res <- convert_input(
input.id = NA,
outfolder = tmpdir,
formatname = NULL,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
library(testthat)
library(ncdf4)
library(PEcAn.DB)

test_download_CRUNCEP <- function(start_date, end_date, lat.in, lon.in, method, maxErrors, sleep) {
# putting logger to debug mode
Expand All @@ -8,12 +9,12 @@ test_download_CRUNCEP <- function(start_date, end_date, lat.in, lon.in, method,
PEcAn.logger::logger.setLevel("DEBUG")

# mocking functions
mockery::stub(PEcAn.DB::convert_input, 'dbfile.input.check', data.frame())
mockery::stub(PEcAn.DB::convert_input, 'db.query', data.frame(id = 1))
mockery::stub(convert_input, 'dbfile.input.check', data.frame())
mockery::stub(convert_input, 'db.query', data.frame(id = 1))

withr::with_dir(tempdir(), {
tmpdir <- getwd()
PEcAn.DB::convert_input(
convert_input(
input.id = NA,
outfolder = tmpdir,
formatname = NULL,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
library(testthat)
library(ncdf4)
library(PEcAn.DB)

test_download_ERA5 <- function(start_date, end_date, lat.in, lon.in, product_types, reticulate_python) {
# putting logger to debug mode
Expand All @@ -9,16 +10,16 @@ test_download_ERA5 <- function(start_date, end_date, lat.in, lon.in, product_typ


# mocking functions
mockery::stub(PEcAn.DB::convert_input, 'dbfile.input.check', data.frame())
mockery::stub(PEcAn.DB::convert_input, 'db.query', data.frame(id = 1))
mockery::stub(convert_input, 'dbfile.input.check', data.frame())
mockery::stub(convert_input, 'db.query', data.frame(id = 1))

# additional mocks needed since download.ERA5 does not return data as other download functions
mockery::stub(PEcAn.DB::convert_input, 'length', 2)
mockery::stub(PEcAn.DB::convert_input, 'purrr::map_dfr', data.frame(missing = c(FALSE), empty = c(FALSE)))
mockery::stub(convert_input, 'length', 2)
mockery::stub(convert_input, 'purrr::map_dfr', data.frame(missing = c(FALSE), empty = c(FALSE)))

withr::with_dir(tempdir(), {
tmpdir <- getwd()
PEcAn.DB::convert_input(
convert_input(
input.id = NA,
outfolder = tmpdir,
formatname = NULL,
Expand Down

0 comments on commit 8ecd9fe

Please sign in to comment.