Skip to content

Commit f9efe89

Browse files
committed
Add detection network tests env var
This is to allow the env var to control skipping the tests which call OpenGWAS.
1 parent 9a55747 commit f9efe89

File tree

10 files changed

+17
-1
lines changed

10 files changed

+17
-1
lines changed

tests/testthat/test_add_metadata.r

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

3+
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
34
skip_if_offline()
45
skip_if_offline(host = "api.opengwas.io")
56
skip_on_cran()

tests/testthat/test_create_test_data.r

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

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

tests/testthat/test_instruments.R

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

3+
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
34
skip_if_offline()
45
skip_if_offline(host = "api.opengwas.io")
56
skip_on_cran()

tests/testthat/test_ld.R

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

3+
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
34
skip_if_offline()
45
skip_if_offline(host = "api.opengwas.io")
56
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

3-
43
test_that("get afl2", {
4+
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
context("mvmr")
22

3+
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
34
skip_on_cran()
45
skip_if_offline()
56
skip_if_offline(host = "api.opengwas.io")

tests/testthat/test_mvmr_local.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +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")
1314
skip_if_offline()
1415
skip_if_offline(host = "api.opengwas.io")
1516
skip_on_cran()

tests/testthat/test_otherformats.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +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")
1617
skip_on_cran()
1718
skip_if_offline()
1819
skip_if_offline(host = "api.opengwas.io")

tests/testthat/test_outcomes.R

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

3+
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
34
skip_if_offline()
45
skip_if_offline(host = "api.opengwas.io")
56
skip_on_cran()

tests/testthat/test_rsq.r

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ test_that("exposure data 1", {
1010
})
1111

1212
test_that("exposure data 2", {
13+
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
1314
skip_if_offline()
1415
skip_if_offline(host = "api.opengwas.io")
1516
skip_on_cran()
@@ -23,6 +24,7 @@ test_that("exposure data 2", {
2324
exposure <- exp_dat[1:5,]
2425

2526
test_that("outcome data 1", {
27+
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
2628
skip_if_offline()
2729
skip_if_offline(host = "api.opengwas.io")
2830
skip_on_cran()
@@ -36,6 +38,7 @@ test_that("outcome data 1", {
3638
})
3739

3840
test_that("outcome data 2", {
41+
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
3942
skip_if_offline()
4043
skip_if_offline(host = "api.opengwas.io")
4144
skip_on_cran()
@@ -49,6 +52,7 @@ test_that("outcome data 2", {
4952
})
5053

5154
test_that("dat 2", {
55+
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
5256
skip_if_offline()
5357
skip_if_offline(host = "api.opengwas.io")
5458
skip_on_cran()
@@ -60,6 +64,7 @@ test_that("dat 2", {
6064
})
6165

6266
test_that("dat ukb-d", {
67+
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
6368
skip_if_offline()
6469
skip_if_offline(host = "api.opengwas.io")
6570
skip_on_cran()
@@ -77,6 +82,7 @@ test_that("effective n", {
7782
})
7883

7984
test_that("get_population_allele_frequency", {
85+
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
8086
skip_if_offline()
8187
skip_if_offline(host = "api.opengwas.io")
8288
skip_on_cran()
@@ -94,6 +100,7 @@ test_that("get_population_allele_frequency", {
94100
})
95101

96102
test_that("bbj-a-1", {
103+
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
97104
skip_on_cran()
98105
skip_if_offline()
99106
skip_if_offline(host = "api.opengwas.io")
@@ -105,6 +112,7 @@ test_that("bbj-a-1", {
105112
})
106113

107114
test_that("bsen vs pn", {
115+
skip_if(Sys.getenv('TWOSAMPLEMR_ENABLE_OPENGWAS_TESTS') != TRUE, "Tests requiring OpenGWAS")
108116
skip_if_offline()
109117
skip_if_offline(host = "api.opengwas.io")
110118
skip_on_cran()

0 commit comments

Comments
 (0)