audrey-b / sims

An R package to simulate data from JAGS or R Code
https://poissonconsulting.github.io/sims/
Other
1 stars 2 forks source link

having to skip code that sets working directory unless run at console #26

Closed joethorley closed 4 years ago

joethorley commented 4 years ago
   skip("only works when run at console")
  tempdir <- file.path(tempdir(), "sims")
  unlink(tempdir, recursive = TRUE)
  teardown(unlink(tempdir, recursive = TRUE))

  set.seed(1)

  dir.create(tempdir)
  wd <- setwd(tempdir)
  on.exit(setwd(wd))
  expect_true(sims_simulate("a ~ dunif(0,1)", save = TRUE, exists = NA,
                              ask = FALSE))
  print(list.files(tempdir, all.files = TRUE, recursive=TRUE))
  expect_identical(list.files(tempdir, all.files = TRUE, recursive=TRUE),
                    c(".sims.rds", "data0000001.rds"))
joethorley commented 4 years ago

I think this is fine - something to do with dir.create() or setwd()