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

Fix/98 update log suppression #99

Merged
merged 3 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
13 changes: 13 additions & 0 deletions tests/testthat/setup.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## save current settings so that we can reset later

## Logger Settings
# Set threshold to OFF, and capture previous state
logger_threshold <- logger::log_threshold("OFF")

## Tear down function
withr::defer(
expr = {
logger::log_threshold(logger_threshold)
},
envir = teardown_env()
)
15 changes: 0 additions & 15 deletions tests/testthat/test-analysis_prechecks.R
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
## save current settings so that we can reset later
threshold <- logger::log_threshold()
appender <- logger::log_appender()
layout <- logger::log_layout()
on.exit({
## reset logger settings
logger::log_threshold(threshold)
logger::log_layout(layout)
logger::log_appender(appender)
})

logger::log_appender(logger::appender_stdout)
logger::log_threshold(logger::FATAL)
logger::log_layout(logger::layout_simple)

test_that("audit_prechecks works when all files are present", {
pacta_data_dir <- withr::local_tempdir()
filenames <- c(
Expand Down
15 changes: 0 additions & 15 deletions tests/testthat/test-audit_prechecks.R
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
## save current settings so that we can reset later
threshold <- logger::log_threshold()
appender <- logger::log_appender()
layout <- logger::log_layout()
on.exit({
## reset logger settings
logger::log_threshold(threshold)
logger::log_layout(layout)
logger::log_appender(appender)
})

logger::log_appender(logger::appender_stdout)
logger::log_threshold(logger::FATAL)
logger::log_layout(logger::layout_simple)

test_that("audit_prechecks works when all files are present", {
pacta_data_dir <- withr::local_tempdir()
filenames <- c(
Expand Down
15 changes: 0 additions & 15 deletions tests/testthat/test-calc_weights_prechecks.R
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
## save current settings so that we can reset later
threshold <- logger::log_threshold()
appender <- logger::log_appender()
layout <- logger::log_layout()
on.exit({
## reset logger settings
logger::log_threshold(threshold)
logger::log_layout(layout)
logger::log_appender(appender)
})

logger::log_appender(logger::appender_stdout)
logger::log_threshold(logger::FATAL)
logger::log_layout(logger::layout_simple)

test_that("audit_prechecks works when all files are present", {
data_dir <- withr::local_tempdir()
filenames <- c(
Expand Down
Loading