Skip to content

Commit d04b847

Browse files
authored
Merge pull request #622 from remlapmot/devel [skip ci]
Use a skip helper function and some minor amends to two vignettes
2 parents 6e3d85e + 4f567ab commit d04b847

File tree

13 files changed

+70
-47
lines changed

13 files changed

+70
-47
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
skip_if_opengwas_tests_disabled <- function() {
2+
if (!identical(Sys.getenv("TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS"), "TRUE")) {
3+
skip("Tests requiring OpenGWAS.")
4+
} else {
5+
invisible()
6+
}
7+
}

tests/testthat/test_add_metadata.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
context("add metadata")
22

3-
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
3+
skip_if_opengwas_tests_disabled()
44
skip_if_offline()
55
skip_if_offline(host = "api.opengwas.io")
66
skip_on_cran()

tests/testthat/test_create_test_data.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
test_that("Create local data", {
2-
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
2+
skip_if_opengwas_tests_disabled()
33
skip("Skip local data creation unless you have good access to the API.")
44

55
exp_dat <- extract_instruments("ieu-a-2")

tests/testthat/test_instruments.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
context("Instruments")
22

3-
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
3+
skip_if_opengwas_tests_disabled()
44
skip_if_offline()
55
skip_if_offline(host = "api.opengwas.io")
66
skip_on_cran()

tests/testthat/test_ld.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
context("ld")
22

3-
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
3+
skip_if_opengwas_tests_disabled()
44
skip_if_offline()
55
skip_if_offline(host = "api.opengwas.io")
66
skip_on_cran()

tests/testthat/test_ldsc.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
context("LDSC")
22

33
test_that("get afl2", {
4-
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
4+
skip_if_opengwas_tests_disabled()
55
skip("Very slow")
66
hm3info <- ieugwasr::afl2_list("hapmap3")
77
if(inherits(hm3info, "response")) skip("Server issues")

tests/testthat/test_mvmr.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
context("mvmr")
22

3-
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
3+
skip_if_opengwas_tests_disabled()
44
skip_on_cran()
55
skip_if_offline()
66
skip_if_offline(host = "api.opengwas.io")

tests/testthat/test_mvmr_local.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ context("mvmr local")
1010
load(system.file("extdata", "test_add_mvmr_local.RData", package="TwoSampleMR"))
1111

1212
test_that("mv exposure local", {
13-
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
13+
skip_if_opengwas_tests_disabled()
1414
skip_if_offline()
1515
skip_if_offline(host = "api.opengwas.io")
1616
skip_on_cran()

tests/testthat/test_otherformats.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test_that("MRInput", {
1313
})
1414

1515
test_that("MRInput with cor", {
16-
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
16+
skip_if_opengwas_tests_disabled()
1717
skip_on_cran()
1818
skip_if_offline()
1919
skip_if_offline(host = "api.opengwas.io")

tests/testthat/test_outcomes.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
context("outcome")
22

3-
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
3+
skip_if_opengwas_tests_disabled()
44
skip_if_offline()
55
skip_if_offline(host = "api.opengwas.io")
66
skip_on_cran()

0 commit comments

Comments
 (0)