HenrikBengtsson / future.tests

:nut_and_bolt: R package: future.tests - Test Suite for Future API Backends
https://future.tests.futureverse.org
10 stars 1 forks source link

TEST: Globals that are copies of non-exported package objects must be kept #14

Closed HenrikBengtsson closed 1 year ago

HenrikBengtsson commented 4 years ago

The following requires that find_files_in_directories() is exported even if it part of the 'utils' namespace:

library(future)
plan(cluster, workers = 1L)
find_files_in_directories <- utils:::find_files_in_directories
f <- future({ list(Sys.getpid(), f=find_files_in_directories) })
value(f)

BTW, it is exported because it lives (= "where") in environment R_GlobalEnv() not the package namespace;

str(f$globals)
List of 1
 $ find_files_in_directories:function (basenames, dirnames)  
 - attr(*, "where")=List of 1
  ..$ find_files_in_directories:<environment: R_GlobalEnv> 
 - attr(*, "class")= chr [1:3] "FutureGlobals" "Globals" "list"
 - attr(*, "resolved")= logi FALSE
 - attr(*, "total_size")= num 37344