File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,23 @@ that the changes look correct, then press Validate.
4646Once you've validated all changes, press Quit and you will be able to commit the
4747changed images and run the tests successfully.
4848
49+ ### Using data files in tests
50+
51+ Unit tests should not depend on being able to load data from the COVIDcast API,
52+ since that data is subject to change. It is preferable to either use toy
53+ examples or to store static datasets to be loaded and used.
54+
55+ Small static datasets can be kept in ` tests/testthat/data/ ` in RDS form (using
56+ ` saveRDS ` and ` loadRDS ` ). The ` testthat::test_path ` function locates files
57+ relative to the ` tests/testthat/ ` directory regardless of your current working
58+ directory, so for example you can use
59+
60+ ``` r
61+ foo <- readRDS(test_path(" data/foo.rds" ))
62+ ```
63+
64+ to load ` tests/testthat/data/foo.rds ` .
65+
4966## Documentation
5067
5168We use
You can’t perform that action at this time.
0 commit comments