[datatable-help] Streamlining unit tests with test_that
Tom Short
tshort.rlists at gmail.com
Tue Nov 30 21:13:30 CET 2010
On Tue, Nov 30, 2010 at 2:45 PM, Steve Lianoglou
<mailinglist.honeypot at gmail.com> wrote:
> 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?
Yes, it does. It's due to cedta. If you put the following into the
datatable-test.R file, you'll find that the top environment (topenv)
is not R_GlobalEnv as needed for cedta to work right. I'm not sure of
a fix or workaround.
print( topenv() )
- Tom
print(topenv())
More information about the datatable-help
mailing list