is this a bug in package testthat?
I would expect x to be always identical to x... Instead I get an error.
x = structure(logical(0), index = structure(numeric(0), tzone = "", tclass = c("POSIXct", "POSIXt")),
.indexCLASS = c("POSIXct", "POSIXt"),…
I have created a markdown script which is producing some ggplot graphs. I also wrote a test script to automatically testing the whole markdown by first extracting the code chunks and then executing the script.
With some test data, I get warnings…
Building a package using testthat for tests; those require an external file which as recommended lies in /tests/testthat/my-file.
However the R CMD check produces
Found the following hidden files and directories:
tests/testthat/my-file
The above…
Is there a way to run testthat tests on build and reload in RStudio? Is it possible to run only a subset of tests?
I find myself writing a test, making a change, build+reload, then manually running tests.
I am confused about something. when I put this function into a package
oddTranspose <- function(x) {
t(x)
}
it works fine
m <- matrix(c(1,0,0,0), nrow=2)
M <- as(m, "Matrix")
oddTranspose(m) # works
oddTranspose(M) # works
but then, when I use…
I'd like to test that a function returns the expected data.frame. The data.frame is too large to define in the R file (eg, using something like structure()). I'm doing something wrong with the environments when I try a simple retrieval from disk,…
library(Rcpp)
cppFunction("
int fib(int n)
{
if (n < 2)
return(n);
return( fib(n-1) + fib(n-2) );
}
")
My task is to write several tests to show whether the case is wrong or not.
However, the wrong messages…
I've two files test_utils.r and test_core.r, they contain tests for various utilities and some core functions separated into different 'context'. I can control the flow of tests within each file by moving around my test_that() statements.
But am…
how to do automatic tests after package build in R - Rstudio - testthat
i have tried:
testPath=paste(getwd(),"/tests/R/",sep="")
codePath=paste(getwd(),"/R/",sep="")
auto_test(test_path=testPath, code_path=codePath)
but this react each time i…
I have written a series of test_that tests. There is one test_that test which has a side-effect of creating a sqlite3 table. The rest of the tests rely on this sqlite3 table. Is there a way to force this one test to run before any of the other…
I have a function that will set up some folders for the rest of my workflow
library(testthat)
analysisFolderCreation<-function(projectTitle=NULL,Dated=FALSE,destPath=getwd(),SETWD=FALSE){
…
I have a test for which if the prerequisites are not met (e.g., missing file or something) I would like to make it fail.
Just for clarification, here's an example I'd like to do:
test_that("...", {
if ( ... precondition to execute the test is…
Summary
I am working on an R package that uses Rcpp. I took over the project with many issues and I am trying to fix them. The problem with this is that I don't know how to create a minimal example for reproduction in this situation because the…