From 21c4645985cc955b4fbee1951d5477773faf034e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Sch=C3=A4fer?= Date: Fri, 15 Jan 2021 20:51:13 +0100 Subject: [PATCH] delete test data from userdir on CRAN --- tests/testthat/teardown-cran.R | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 tests/testthat/teardown-cran.R diff --git a/tests/testthat/teardown-cran.R b/tests/testthat/teardown-cran.R new file mode 100644 index 0000000..6678133 --- /dev/null +++ b/tests/testthat/teardown-cran.R @@ -0,0 +1,10 @@ +# Starting in Jan 2021, CRAN starts nagging you about leaving files in the userdir. +# We have to store data there to be able to get away with the 5 MB (!) package size limit and +# still be able to run unit tests on CRAN. +# We have 2 options: 1) do not run any unit tests requiring data on CRAN (almost all of our tests require data). +# 2) download the data and delete everything afterwards, on CRAN (users will want to keep the data, as they only have it if they decided to download it). +# So we delete all data ONLY if we are on CRAN in this teardown file. + +if(!identical(Sys.getenv("NOT_CRAN"), "true")) { + freesurferformats::delete_all_opt_data(); +}