skip_if_stock_db_not_ready: Skip tests if stock db is not ready

Description Usage Arguments Details Value Examples

View source: R/utils-testthat-helpers.R

Description

This wrapper of skip_if_not() to skip tests if stock db is not available for testing.

Usage

1
skip_if_stock_db_not_ready(dsn = "GTA_SQLData")

Arguments

dsn

A string of DSN to connected. Default value "GTA_SQLData".

Details

You could simulate a environment without stock db by setting environment variable "NO_STOCK_DB" to "true".

Value

No return value

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## Not run: 

# Skip tests when stock db is unavailable in the test file
skip_if_stock_db_not_ready()
test_that("tests related to stock db", {
  expect_equal(1, 3) #'
})

# Run Tests in a simulated environment without stock db
withr::with_envvar(
  new = c("NO_STOCK_DB" = "true"),
  devtools::test() # test package
)

## End(Not run)

chriszheng2016/zstmodelr documentation built on June 13, 2021, 8:59 p.m.