https://github.com/henrikbengtsson/future.tests
:nut_and_bolt: R package: future.tests - Test Suite for Future API Backends
https://github.com/henrikbengtsson/future.tests
future package r testing
Last synced: 5 months ago
JSON representation
:nut_and_bolt: R package: future.tests - Test Suite for Future API Backends
- Host: GitHub
- URL: https://github.com/henrikbengtsson/future.tests
- Owner: HenrikBengtsson
- Created: 2017-05-17T00:37:58.000Z (almost 8 years ago)
- Default Branch: develop
- Last Pushed: 2024-10-27T03:55:06.000Z (7 months ago)
- Last Synced: 2024-12-04T09:39:41.479Z (5 months ago)
- Topics: future, package, r, testing
- Language: R
- Homepage: https://future.tests.futureverse.org
- Size: 883 KB
- Stars: 10
- Watchers: 3
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS.md
- Contributing: CONTRIBUTING.md
Awesome Lists containing this project
README
# future.tests: Test Suite for 'Future API' Backends
The **[future]** package defines the Future API which consists of a small number of functions for writing [R] code that can be evaluated either sequential or in parallel based a single setting without having to change anything in the code. Parallelization can be done via one of many backends, e.g. via built-in multicore, multisession and cluster backends (based on the **parallel** package) or via third-party backends such as **[future.callr]** and **[future.batchtools]**. The design motto of the Future API is:
> Write once, run anywhere
In order for such code to work regardless of which future backend the end-user choose, it is critical that the backend fully complies with the [Future API Backend Specification]. A future backend with a 100% compliance rate guarantees that the code will work equally well there as in sequential mode.
This R package - **[future.tests]** - provides a test suite for validation that a future backend complies with the Future API.

## Validate a Future Backend
All future backends implementing the Future API should validate that they conform to the Future API. This can be done using the **[future.tests]** package, which provides two API for running the tests. The tests can be performed either from within R or from outside of R from the command line making it easy to include them package tests and in Continuous Integration (CI) pipelines.
### From Within R
```r
> results <- future.tests::check(plan = "multisession")
> exit_code <- attr(results, "exit_code")
> if (exit_code != 0) stop("One or more tests failed")
```### From Outside R
```sh
$ Rscript -e future.tests::check --args --test-plan="multisession"
$ exit_code=$?
$ [[ exit_code -eq 0 ]] || { >&2 echo "One or more tests failed"; exit 1; }
```[R]: https://www.r-project.org
[future]: https://cran.r-project.org/package=future
[future.callr]: https://cran.r-project.org/package=future.callr
[future.batchtools]: https://cran.r-project.org/package=future.batchtools
[future.tests]: https://cran.r-project.org/package=future.tests
[Future API Backend Specification]: https://future.futureverse.org/articles/future-6-future-api-backend-specification.html## Installation
R package future.tests is available on [CRAN](https://cran.r-project.org/package=future.tests) and can be installed in R as:
```r
install.packages("future.tests")
```### Pre-release version
To install the pre-release version that is available in Git branch `develop` on GitHub, use:
```r
remotes::install_github("HenrikBengtsson/future.tests", ref="develop")
```
This will install the package from source.## Contributing
To contribute to this package, please see [CONTRIBUTING.md](CONTRIBUTING.md).