[datatable-help] Streamlining unit tests with test_that

Steve Lianoglou mailinglist.honeypot at gmail.com
Tue Nov 30 20:45:39 CET 2010


Hi,

So I mentioned in my last email that I'm going to get back to this
later, but I'm a bit OCD when I have what seems like low-hanging-fruit
so I'm trying to figure this out.

I also mentioned I think the problem I'm seeing has something to do
with the "cedta" business. While fixing this case will help me move
the test over, perhaps it will also help to better address the
side-effects cedta has with other things like Imports, Depends,
etc.(?)

So, download this simple test file:

http://cbio.mskcc.org/~lianos/files/scratch/datatable-test.R

Note that the first call to sys.source works fine, but I think it
should work with the second case.

Start an R session, and:

R> library(data.table)
R> sys.source("/path/to/datatable-test.R", .GlobalEnv) ## this works
R> sys.source("/path/to/datatable-test.R", new.env(parent=.GlobalEnv))
Error in `[.data.frame`(x, i, j) : object 'v' not found

Does it seem reasonable to you that it should work in the second example?

I tried doing some trickery in the datatable-test.R function by
unloading and reloading namespaces ... `require`-ing the package in
that file, etc. but to no avail. Instead of continuing stabbing at the
dark, I was hoping I could see if you guys could think of a fix.

Thanks,
-steve

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact


More information about the datatable-help mailing list