Now asserting that immediate conditions are relayed, where possible.
The test for cancel() and value() now asserts that value() on
a canceled future signals a FutureCanceledError, which inherits
from FutureInterruptError, also when canceled with
interrupt = FALSE, when the backend does not support interrupts,
and for lazy futures. A new test asserts the same for a future that
has already been collected. The new assertions are skipped when
testing against a version of the future package that does not
yet include the corresponding bug fix.
Add tests for value() on lists of futures asserting that (i)
argument init of reduce, and arguments stdout and signal,
are respected also with inorder = FALSE, (ii) an error cancels
and resolves the remaining futures, without launching lazy ones,
(iii) a future that returns an error object is not mistaken for a
failed future, and (iv) standard output and messages of all
futures are relayed in order also with drop = TRUE.
Add test asserting that futureCall() passes language objects, e.g.
symbols and calls, in argument args as-is to FUN.
The above tests are skipped when testing against a version of the future package that does not yet include the corresponding bug fix.
Add tests for (i) globals specified as a character vector with
attributes add and ignore, (ii) unused variables not being
exported as globals, (iii) a global ... together with a global
...future.FUN(), (iv) switching plan while a future is running,
(v) repeated value() on an interrupted future, (vi) launching
many futures without leaving unused connections behind, (vii)
immediate conditions not being re-signaled, and (viii)
makeClusterFuture() passing language objects as-is and supporting
clusterEvalQ() that only attaches packages.
Add tests for (i) future(..., packages = "missing-package")
signaling an error, (ii) value(<listenv>, idxs), (iii)
value(<list>, reduce = structure("+", init = 42)), (iv) result()
on a canceled and interrupted future, and (v) errors from a
makeClusterFuture() cluster being signaled as by other clusters.
check() gained argument index and command-line option
--test-index=<index> for running a subset of the tests by their
numbers, e.g. --test-index=42 and --test-index=2:13,14.
run_tests() gained argument timeout.
Loading the package overwrote options future.tests.debug and
mc.cores, if already set. Now they are only set if not already
set, except that command-line option --cores=<n> still sets
mc.cores.
run_test(local = FALSE) and check(local = FALSE) left the test
arguments, e.g. lazy, globals, and stdout, behind in the
evaluation environment, which by default is the global environment,
overwriting any existing variables with the same names. Now such
variables are removed or restored afterward.
Test 'futureCall() - globals = list(a = 3)' used variable globals
without declaring it as a test argument, which caused it to fail
when run without globals among the default arguments, e.g. via
run_tests().
Popping the internal test-state stack when it was empty, e.g. after resetting it, removed all environment variables and options. Now it produces an error instead.
as.data.frame() for a TestResult reported a skipped test as
successful, i.e. success = TRUE, whereas print() reports it as
Success: NA. Now success is NA also for skipped tests.
When the future plan could not be restored after a test, an obscure 'invalid argument type' error message was produced instead of reporting that the plan differed.
check(timeout = <seconds>) no longer leaves option
future.tests.timeout set after returning.
check() failed to set the future plan when the specified plan
contained the word "plan", e.g. --test-plan=planned::foo.
check() ignored command-line options --session-info and
--debug.
check() produced garbled output with interleaved spinner frames
and test titles when standard output or standard error was not a
terminal, e.g. when the output was piped or written to a log
file. The in-place progress is now only shown when both are
terminals, which can be overridden by option
future.tests.progress.
check_plan() and as.data.frame() for tests coerced character
test arguments to factors.
check_plan() failed with error 'is_string(left) is not TRUE' when
the call of the current future plan was long, e.g. when using
--test-plan= with a cluster of several workers.
check_plan(defaults = list()) silently skipped tests without
arguments.
run_tests(defaults = NULL) failed with an error.
run_tests() failed with its default arguments, because tests that
declare arguments, e.g. lazy, required those to be specified via
defaults or to exist in envir. Now such arguments default to the
first value declared by the test.
run_test() recorded and restored the variables of its own call frame
instead of those of the environment where the test is evaluated, so
variables created by a test with local = FALSE were never removed.
run_test() would use a function as the value of a missing test argument
when a function of the same name existed, e.g. stdout(), instead of
reporting the argument as missing.
make_test() accepted a missing title (NA).
evaluate_expr() and run_test() would fail with a 'reached
elapsed time limit' error when a test timed out.
subset_tests(args, defaults) ignored the arguments of the tests.
along_test_plans() dropped errors and NULL results. Errors are
now returned as the result for the plan, and evaluation continues.
Package utils is now declared as an imported package instead of just a suggested package.
Now requires future (>= 1.80.0). Removed the tests' version checks and skips for earlier future versions, which are no longer needed.
Add logical R option future.tests.devel, which can be set by
environment variable R_FUTURE_TESTS_DEVEL. This controls whether
tests with a "devel" ("under development") tag will be included.
check() reports on future version.
Add tests for cancel().
Assert that plan() accepts argument interrupts.
Remove tests on future(..., earlySignal = FALSE/TRUE), because
that is about to be deprecated in the future package.
Relax assertions in test of resolved() with lazy futures.
plan() adjusting argument workers were not skipped if
the plan tested already sets argument workers to a fixed value,
e.g. plan(cluster, workers = cl).Now load_tests() returns a named list, where the names
corresponds to the test titles.
Now future.tests::check("mirai::daemons(2); plan(future.mirai::mirai_cluster)") works.
plan() test on legacy constant backend.Tests asserting correctness of nbrOfWorkers() could produce an
"invalid format '%d'; use format %f, %e, %g or %a for numeric
objects" error when trying to produce an assertion error on
nbrOfWorkers() having an incorrect value. This could happen if
nbrOfWorkers() returned a non-integer value, e.g. +Inf.
Test asserting that the workers argument can be a function would
not always work if testing with a hardcoded number of workers
according to plan().
Test asserting that the workers argument can be a function would
not work if the backend's default value was non-numeric, e.g. the
cluster backend defaults to the character vector
parallelly::availableWorkers().
Test asserting that lazy futures would be automatically launched
and resolved relied on a legacy version of the Future API, where
calling resolved() on a lazy future could leave it in a lazy
state, which is no longer correct. A lazy future will always be
launched if one calls resolved() on it.
Test asserting that the ff package worked across multiple futures assumed that the package is loaded automatically by the future, which it is not. The could cause the test to fail for some future backends.
Now tests can be formally skipped by calling
future.tests::skip_test() from within the test. Skipped tests
are counted and reported in the summary.
Now check_plan() outputs the reason for a test being skipped.
Now check_plan() outputs also the error message, error class, the
call, and any standard output, whenever there is a test error.
Now check_plan() outputs also the test iteration index.
Added Rscript -e future.tests::check --version.
workers
argument, which is not true for all future backends. For example,
'sequential' does not take argument workers. Previously, we
avoided this problem by only testing if the evaluator inherited
multiprocess, but that is not sufficient, e.g. upcoming
future.redis::redis inherits multiprocess, but still does not
have a workers argument. Now we check for the workers argument
instead.future(), run(), result() and value()
update the RNG state.Assert that rm(a) in a future expression only removes a local
variable a, but never a global variable a.
Assert that packages data.table and ff are not affected when a future resets the R options on the worker when resolved.
Assert that a global that is a copy of a non-exported package
object (e.g. utils:::str2logical()) is not dropped because it
belongs to a package namespace.
Assert that ... can be exported as a global to a future, and
used as-is inside a function that does not have ... arguments.
check() and check_plan() gained argument local, which is
passed down to run_test().
check() gained argument envir, which is passed down to
run_test().
The TestResult class did not record whether the test was evaluated in a local environment or not.
A too strict internal assertion would give Error in evaluate_expr(test$expr, envir = envir, local = FALSE, output = output, : identical(Sys.getenv(), old$envvars) is not TRUE for R
4.2.x and R-devel on MS Windows. This was because it is not
possible to remove environment variables on MS Windows; they can
only be set to an empty value.
Assert that future() doesn't change the RNG kind.
Assert that future(..., conditions = character(0L)) muffles all
conditions.
For robustness, using explicit stringsAsFactors = FALSE
internally.
evaluate_expr(), which is used for running all tests, now reset
options, environment variables, the RNG kind, and the random seed
afterward to what it was before being called.
Added package vignettes.
resolve() would use deprecated argument value.Update the package description to use single quotes.
Add example to check().
resolved() will launch lazy futures.In non-interactive mode, check() will quit R with an exit code
that reflects whether all tests passed (0) or not (1).
check() gained arguments so that it can be easily called from R
too.