Skip to content

Commit

Permalink
Try waiting btw calls to fix travis fails
Browse files Browse the repository at this point in the history
  • Loading branch information
mwmclean committed Dec 7, 2018
1 parent acf970c commit a1b716b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/testthat/test-pubmed.R
Expand Up @@ -9,7 +9,7 @@ context("PubMed")
test_that("GetPubMedByID can process books (#2)", {
skip_on_cran()
if (httr::http_error("https://eutils.ncbi.nlm.nih.gov/"))
skip("Couldn't connect to Entrez")
skip("Couldn't connect to Entrez")

test <- GetPubMedByID(c("24977996", "24921111"))
if (length(test))
Expand All @@ -19,7 +19,8 @@ test_that("GetPubMedByID can process books (#2)", {
test_that("GetPubMedByID uses collective name if authors missing (#2)", {
skip_on_cran()
if (httr::http_error("https://eutils.ncbi.nlm.nih.gov/"))
skip("Couldn't connect to Entrez")
skip("Couldn't connect to Entrez")
Sys.sleep(2)

try_again(3, test <- GetPubMedByID(c(11678951, 15373863)))
if (length(test)){
Expand All @@ -32,6 +33,8 @@ test_that("GetPubMedByID warns if authors missing (#3)", {
skip_on_cran()
if (httr::http_error("https://eutils.ncbi.nlm.nih.gov/"))
skip("Couldn't connect to Entrez")
Sys.sleep(2)

BibOptions(check.entries = FALSE)
expect_warning(try_again(3, GetPubMedByID("7936917")))
})
Expand All @@ -41,18 +44,21 @@ test_that("LookupPubMedID successfully retrieves and add ID's'", {
file.name <- system.file("Bib", "RJC.bib", package="RefManageR")
bib <- ReadBib(file.name)
if (httr::http_error("https://eutils.ncbi.nlm.nih.gov/"))
skip("Couldn't connect to Entrez")
skip("Couldn't connect to Entrez")
Sys.sleep(2)
try_again(3, out <- LookupPubMedID(bib[[101:102]]))
expect_equal(length(out), 2L)
ids <- setNames(unlist(out$eprint), NULL)
expect_equal(ids, c("19381352", "19444335"))
Sys.sleep(2)
expect_message(try_again(3, LookupPubMedID(bib, 453)), "No PubMed ID's found")
})

test_that("GetPubMedByID reading of years/months (#52)", {
skip_on_cran()
if (httr::http_error("https://eutils.ncbi.nlm.nih.gov/"))
skip("Couldn't connect to Entrez")
Sys.sleep(2)
try_again(3, bib <- GetPubMedByID("23891459"))
expect_equal(bib$year, "2013")
expect_equal(bib$month, "07")
Expand Down

0 comments on commit a1b716b

Please sign in to comment.