From 00a1c8ce80d2fe3c799c2477fdd1c0a0fdd0a61e Mon Sep 17 00:00:00 2001 From: Are Edvardsen Date: Wed, 16 Feb 2022 12:16:38 +0100 Subject: [PATCH 1/4] old funs defunct --- R/AutoReportFuns.R | 14 +++++++------- R/GetShinyUserGroups.R | 2 +- R/GetShinyUserName.R | 2 +- R/GetShinyUserReshId.R | 2 +- R/GetShinyUserRole.R | 2 +- R/LoadRegData.R | 4 ++-- R/MakeMessage.R | 2 +- R/ShinySessionInfo.R | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/R/AutoReportFuns.R b/R/AutoReportFuns.R index d5ccbec4..f7f4bd8c 100644 --- a/R/AutoReportFuns.R +++ b/R/AutoReportFuns.R @@ -328,7 +328,7 @@ filterAutoRep <- function(data, by, pass) { #' @export selectByReg <- function(config, reg) { - lifecycle::deprecate_warn( + lifecycle::deprecate_stop( "1.12.0", "selectByReg()", "filterAutoRep()" ) if (length(config) == 0) { @@ -356,7 +356,7 @@ selectByReg <- function(config, reg) { #' @export selectByType <- function(config, type) { - lifecycle::deprecate_warn( + lifecycle::deprecate_stop( "1.12.0", "selectByType()", "filterAutoRep()" ) if (length(config) == 0) { @@ -384,7 +384,7 @@ selectByType <- function(config, type) { #' @export selectByOwner <- function(config, owner) { - lifecycle::deprecate_warn( + lifecycle::deprecate_stop( "1.12.0", "selectByOwner()", "filterAutoRep()" ) if (length(config) == 0) { @@ -412,7 +412,7 @@ selectByOwner <- function(config, owner) { #' @export selectByOrganization <- function(config, organization) { - lifecycle::deprecate_warn( + lifecycle::deprecate_stop( "1.12.0", "selectByOrganization()", "filterAutoRep()" ) if (length(config) == 0) { @@ -885,7 +885,7 @@ makeAutoReportTab <- function(session, namespace = character(), #' @export makeUserSubscriptionTab <- function(session, mapOrgId = NULL) { - lifecycle::deprecate_warn( + lifecycle::deprecate_stop( "1.12.0", "rapbase::makeUserSubscriptionTab()", "rapbase::makeAutoReportTab()" ) @@ -956,7 +956,7 @@ NULL #' @rdname makeUserSubscriptionTabV2 #' @export makeUserSubscriptionTab_v2 <- function(session, map_resh_name = NULL) { - lifecycle::deprecate_warn( + lifecycle::deprecate_stop( "1.12.0", "rapbase::makeUserSubscriptionTab_v2()", "rapbase::makeUserDispatchmentTab()", details = paste( @@ -1032,7 +1032,7 @@ makeUserSubscriptionTab_v2 <- function(session, map_resh_name = NULL) { #' @rdname makeUserSubscriptionTabV2 #' @export makeUserSubscriptionTabV2 <- function(session, map_resh_name = NULL) { - lifecycle::deprecate_warn( + lifecycle::deprecate_stop( "1.12.0", "rapbase::makeUserSubscriptionTabV2()", "rapbase::makeUserDispatchmentTab()", details = paste( diff --git a/R/GetShinyUserGroups.R b/R/GetShinyUserGroups.R index 6073de36..b96d2844 100644 --- a/R/GetShinyUserGroups.R +++ b/R/GetShinyUserGroups.R @@ -11,7 +11,7 @@ getShinyUserGroups <- function(shinySession, testCase = FALSE) { - lifecycle::deprecate_warn( + lifecycle::deprecate_stop( "1.10.0", "rapbase::GetShinyUserGroups()", "rapbase::getUserGroups()" ) diff --git a/R/GetShinyUserName.R b/R/GetShinyUserName.R index 5279fc32..de000867 100644 --- a/R/GetShinyUserName.R +++ b/R/GetShinyUserName.R @@ -11,7 +11,7 @@ getShinyUserName <- function(shinySession, testCase = FALSE) { - lifecycle::deprecate_warn( + lifecycle::deprecate_stop( "1.10.0", "rapbase::GetShinyUserName()", "rapbase::getUserName()" ) diff --git a/R/GetShinyUserReshId.R b/R/GetShinyUserReshId.R index 5c1b9cb4..90737fc2 100644 --- a/R/GetShinyUserReshId.R +++ b/R/GetShinyUserReshId.R @@ -11,7 +11,7 @@ getShinyUserReshId <- function(shinySession, testCase = FALSE) { - lifecycle::deprecate_warn( + lifecycle::deprecate_stop( "1.10.0", "rapbase::GetShinyUserReshId()", "rapbase::getUserReshId()" ) diff --git a/R/GetShinyUserRole.R b/R/GetShinyUserRole.R index 04ca5b10..697c3892 100644 --- a/R/GetShinyUserRole.R +++ b/R/GetShinyUserRole.R @@ -11,7 +11,7 @@ getShinyUserRole <- function(shinySession, testCase = FALSE) { - lifecycle::deprecate_warn( + lifecycle::deprecate_stop( "1.10.0", "rapbase::GetShinyUserRole()", "rapbase::getUserRole()" ) diff --git a/R/LoadRegData.R b/R/LoadRegData.R index f35d2e27..03e6a0d6 100644 --- a/R/LoadRegData.R +++ b/R/LoadRegData.R @@ -18,7 +18,7 @@ NULL #' @rdname loadRegData #' @export LoadRegData <- function(registryName, query, dbType = "mysql") { - lifecycle::deprecate_warn( + lifecycle::deprecate_stop( "1.12.0", "rapbase::LoadRegData()", "rapbase::loadRegData()" ) @@ -71,4 +71,4 @@ describeRegistryDb <- function(registryName, tabs = c()) { } desc -} \ No newline at end of file +} diff --git a/R/MakeMessage.R b/R/MakeMessage.R index 6bb023fa..fbffe14a 100644 --- a/R/MakeMessage.R +++ b/R/MakeMessage.R @@ -17,7 +17,7 @@ NULL #' @export MakeMessage <- function(story, message, newLine = TRUE, newPara = FALSE, timeStamp = TRUE) { - lifecycle::deprecate_warn("1.12.0", "rapbase::MakeMessage()", + lifecycle::deprecate_stop("1.12.0", "rapbase::MakeMessage()", "rapbase::makeMessage()", details = "Purely camelCase conformity :-)" ) diff --git a/R/ShinySessionInfo.R b/R/ShinySessionInfo.R index 2b4c680e..1ebf78ef 100644 --- a/R/ShinySessionInfo.R +++ b/R/ShinySessionInfo.R @@ -18,7 +18,7 @@ #' @export shinySessionInfo <- function(shinySession, entity, testCase = FALSE) { - lifecycle::deprecate_warn( + lifecycle::deprecate_stop( "1.10.0", "rapbase::shinySessionInfo()", "rapbase::userInfo()" ) From 47a38e455164422c45111bbfebc4a37647d11f89 Mon Sep 17 00:00:00 2001 From: Are Edvardsen Date: Wed, 16 Feb 2022 12:42:35 +0100 Subject: [PATCH 2/4] reflect defunct deprecated funs --- tests/testthat/test-auto-report-functions.R | 45 ----------------- tests/testthat/test-dbConnection.R | 4 +- tests/testthat/test-message.R | 4 +- tests/testthat/test-shinySessionInfo.R | 56 ++------------------- 4 files changed, 9 insertions(+), 100 deletions(-) diff --git a/tests/testthat/test-auto-report-functions.R b/tests/testthat/test-auto-report-functions.R index 81e45b5f..d9a894a7 100644 --- a/tests/testthat/test-auto-report-functions.R +++ b/tests/testthat/test-auto-report-functions.R @@ -38,23 +38,6 @@ test_that("auto reports can be filterd by valid entity on empty input", { expect_true(is.list(filterAutoRep(list(), "package", c("test")))) }) -test_that("Config data can be filterd by registry on empty input", { - expect_true(is.list(selectByReg(list(), "test"))) -}) - -test_that("config data can be filterd by type on empty input", { - expect_true(is.list(selectByType(list(), "test"))) -}) - -test_that("Config data can be filterd by owner on empty input", { - expect_true(is.list(selectByOwner(list(), "test"))) -}) - -test_that("Config data can be filtered by organization on empty input", { - expect_true(is.list(selectByOrganization(list(), "test"))) -}) - - test_that("Auto report can be created as dry run (stout)", { res <- createAutoReport(synopsis, package, type, fun, paramNames, paramValues, owner, ownerName, email, organization, @@ -77,22 +60,6 @@ Sys.setenv(R_RAP_INSTANCE = "") rd <- readAutoReportData() -test_that("Auto reports can be filtered by registry/package", { - expect_true(is.list(selectByReg(rd, package))) -}) - -test_that("Auto reports can be filtered by type", { - expect_true(is.list(selectByType(rd, type))) -}) - -test_that("Auto reports can be filtered by owner", { - expect_true(is.list(selectByOwner(rd, owner))) -}) - -test_that("Auto reports can be filtered by organization", { - expect_true(is.list(selectByOrganization(rd, organization))) -}) - test_that("Registries/packages can be extracted from config", { expect_true(is.vector(getRegs(rd))) }) @@ -190,18 +157,6 @@ test_that("a registry dispatchment table (for shiny) can be made", { )) }) -test_that("A per-user subscription table (for shiny) can be made", { - expect_true(is.list(makeUserSubscriptionTab(session = shinySession))) -}) - -test_that("per user subscription table provides warning for deprecated v2", { - expect_warning(makeUserSubscriptionTab_v2(session = shinySession)) -}) - -test_that("per-user subscription table for v2 also provides dep warning", { - expect_warning(makeUserSubscriptionTabV2(session = shinySession)) -}) - test_that("Writing conf with undefined R_RAP_CONFIG_PATH provides an error", { expect_error(writeAutoReportData(config = NULL)) }) diff --git a/tests/testthat/test-dbConnection.R b/tests/testthat/test-dbConnection.R index c0f2c702..5892da2b 100644 --- a/tests/testthat/test-dbConnection.R +++ b/tests/testthat/test-dbConnection.R @@ -67,10 +67,10 @@ test_that("A mysql db connection and driver can be provided and cleaned", { expect_false(RMariaDB::dbIsValid(l$con)) }) -test_that("Deprecated interface provides a warning", { +test_that("Deprecated defunct interface provides an error", { checkDb() query <- "SELECT * FROM testTable" - expect_warning(LoadRegData(regName, query, dbType = "mysql")) + expect_error(LoadRegData(regName, query, dbType = "mysql")) }) test_that("Data can be queried from (MySQL) db", { diff --git a/tests/testthat/test-message.R b/tests/testthat/test-message.R index 2b784f30..75f288fa 100644 --- a/tests/testthat/test-message.R +++ b/tests/testthat/test-message.R @@ -1,7 +1,7 @@ context("Generate messages") -test_that("deprecated function provides warning", { - expect_warning(MakeMessage("test", "test")) +test_that("deprecated defunct function provides warning", { + expect_error(MakeMessage("test", "test")) }) test_that("Function return one element atomic char vector", { diff --git a/tests/testthat/test-shinySessionInfo.R b/tests/testthat/test-shinySessionInfo.R index b4964c82..36c7172a 100644 --- a/tests/testthat/test-shinySessionInfo.R +++ b/tests/testthat/test-shinySessionInfo.R @@ -19,7 +19,7 @@ attr(shinySession, "class") <- "ShinySession" # now deprecated, main function test_that("shinySessionInfo() is deprecated", { - expect_warning(shinySessionInfo( + expect_error(shinySessionInfo( shinySession = shinySession, entity = "user" )) @@ -27,54 +27,8 @@ test_that("shinySessionInfo() is deprecated", { # now deprecated, wrapper functions test_that("wrapper funs are deprecated", { - expect_warning(getShinyUserName(shinySession), - class = "lifecycle_warning_deprecated" - ) - expect_warning(getShinyUserGroups(shinySession), - class = "lifecycle_warning_deprecated" - ) - expect_warning(getShinyUserReshId(shinySession), - class = "lifecycle_warning_deprecated" - ) - expect_warning(getShinyUserRole(shinySession), - class = "lifecycle_warning_deprecated" - ) -}) - -# now deprecated, but should still work -withr::local_options(list(lifecycle_verbosity = "quiet")) - -test_that("Default is to assume real data scenario", { - expect_equal(getShinyUserName(shinySession), "user1") - expect_equal(getShinyUserGroups(shinySession), "group1,group2") - expect_equal(getShinyUserReshId(shinySession), "789012") - expect_equal(getShinyUserRole(shinySession), "LC") -}) - -test_that("Also working for test cases", { - expect_equal( - getShinyUserName(shinySessionTest, testCase = TRUE), - "testUser1" - ) - expect_equal( - getShinyUserGroups(shinySessionTest, testCase = TRUE), - "testGroup1,testGroup2" - ) - expect_equal( - getShinyUserReshId(shinySessionTest, testCase = TRUE), - "123456" - ) - expect_equal(getShinyUserRole(shinySessionTest, testCase = TRUE), "LU") -}) - -test_that("Function handle errors", { - expect_error(shinySessionInfo(shinySession = NULL, entity = "user")) - expect_error(shinySessionInfo( - shinySession = shinySessionWrongClass, - entity = "user" - )) - expect_error(shinySessionInfo( - shinySession = shinySession, - entity = "" - )) + expect_error(getShinyUserName(shinySession)) + expect_error(getShinyUserGroups(shinySession)) + expect_error(getShinyUserReshId(shinySession)) + expect_error(getShinyUserRole(shinySession)) }) From a7e16def4c86b01e2aa563bf0cd7c842be41cfe5 Mon Sep 17 00:00:00 2001 From: Are Edvardsen Date: Wed, 16 Feb 2022 13:00:28 +0100 Subject: [PATCH 3/4] silence warning from sectsty package --- inst/template/default.latex | 3 +++ 1 file changed, 3 insertions(+) diff --git a/inst/template/default.latex b/inst/template/default.latex index 9c8eaac8..d3410b00 100644 --- a/inst/template/default.latex +++ b/inst/template/default.latex @@ -6,7 +6,10 @@ \usepackage{booktabs} \usepackage[24hr]{datetime} \usepackage{xcolor} +\usepackage[immediate]{silence} +\WarningFilter[temp]{latex}{Command} % silence the warning \usepackage{sectsty} +\DeactivateWarningFilters[temp] % So nothing unrelated gets silenced \usepackage{marginnote} \usepackage[utf8]{inputenc} \usepackage[norsk]{babel} From 583a190c316fffc7518e284ae19fcb4b5d9a6c81 Mon Sep 17 00:00:00 2001 From: Are Edvardsen Date: Thu, 17 Feb 2022 10:19:29 +0100 Subject: [PATCH 4/4] silence.sty not available at Rapporteket --- inst/template/default.latex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inst/template/default.latex b/inst/template/default.latex index d3410b00..35f04df8 100644 --- a/inst/template/default.latex +++ b/inst/template/default.latex @@ -6,10 +6,10 @@ \usepackage{booktabs} \usepackage[24hr]{datetime} \usepackage{xcolor} -\usepackage[immediate]{silence} -\WarningFilter[temp]{latex}{Command} % silence the warning +%\usepackage[immediate]{silence} +%\WarningFilter[temp]{latex}{Command} % silence the warning \usepackage{sectsty} -\DeactivateWarningFilters[temp] % So nothing unrelated gets silenced +%\DeactivateWarningFilters[temp] % So nothing unrelated gets silenced \usepackage{marginnote} \usepackage[utf8]{inputenc} \usepackage[norsk]{babel}