Skip to content

Commit

Permalink
update test to skip if parallel is loaded
Browse files Browse the repository at this point in the history
This is what I get for pushing to master -_-
  • Loading branch information
zkamvar committed Feb 6, 2016
1 parent 69912c7 commit 96f8cb2
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions tests/testthat/test_genlight.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
context("Genlight construction")


test_that("glSim does not call parallel by default", {
skip_on_cran()
if ("parallel" %in% sessionInfo()$basePkgs){
skip("parallel is already loaded")
}
no_parallel <- sessionInfo()$basePkgs
expect_false("parallel" %in% no_parallel)
x <- glSim(2, n.snp.nonstruc = 10, n.snp.struc = 10, parallel = FALSE)
check_parallel <- sessionInfo()$basePkgs
expect_false("parallel" %in% check_parallel)
expect_is(x, "genlight")
})

test_that("Genlight objects can be created predictably", {
skip_on_cran()
expect_warning(a <- new("genlight", list(c(1,0,1), c(0,0,1,0)), parallel = FALSE ))
Expand Down Expand Up @@ -90,15 +104,3 @@ test_that("genlight objects do not take a mixture of positive and negative subsc
skip_on_cran()
expect_error(xx[, c(2, -1)], "subscripts.")
})


test_that("glSim does not call parallel by default", {
skip_on_cran()
detach("package:parallel")
no_parallel <- sessionInfo()$basePkgs
expect_false("parallel" %in% no_parallel)
x <- glSim(2, n.snp.nonstruc = 10, n.snp.struc = 10, parallel = FALSE)
check_parallel <- sessionInfo()$basePkgs
expect_false("parallel" %in% check_parallel)
expect_is(x, "genlight")
})

0 comments on commit 96f8cb2

Please sign in to comment.