Skip to content

Commit

Permalink
Disable many unit tests on CRAN as requested by CRAN maintainers.
Browse files Browse the repository at this point in the history
  • Loading branch information
dfsp-spirit committed Sep 10, 2020
1 parent ff6aeb5 commit 733ddb2
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/testthat/test-brainview_magic.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

test_that("Creating pub-ready figure export from coloredmeshes works.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
fsbrain::download_optional_data();
fsbrain::download_fsaverage(accept_freesurfer_license = TRUE);
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-export.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

test_that("Exporting coloredmeshes to vertex-colored PLY meshes works.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
fsbrain::download_optional_data();
subjects_dir = fsbrain::get_optional_data_filepath("subjects_dir");
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-mesh_helpers.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
test_that("Label border can be computed", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
fsbrain::download_optional_data();
subjects_dir = fsbrain::get_optional_data_filepath("subjects_dir");
Expand All @@ -24,6 +25,7 @@ test_that("Label border can be computed", {


test_that("Label border can be computed, thickened and visualized", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires X11 and all test data.");

Expand Down Expand Up @@ -60,6 +62,7 @@ test_that("Label border can be computed, thickened and visualized", {


test_that("The borders of all annotation regions can be computed", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires X11 and takes a while.");

Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-morph_atlas_agg.R
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ test_that("Spreading a single value over an atlas region works from manually cre
})

test_that("Writing MGH data spread over regions works", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
fsbrain::download_optional_data();
subjects_dir = fsbrain::get_optional_data_filepath("subjects_dir");
Expand All @@ -185,6 +186,7 @@ test_that("Writing MGH data spread over regions works", {
})

test_that("Writing faverage region values works", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
hemi = "lh";
atlas = "aparc";
Expand Down Expand Up @@ -337,6 +339,7 @@ test_that("Subject annotation works", {


test_that("Merging annotations works", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
fsbrain::download_optional_data();
subjects_dir = fsbrain::get_optional_data_filepath("subjects_dir");
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-rglactions.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

test_that("Hemis can be shifted apart using rglactions for non-overlapping rendering.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");

fsbrain::download_optional_data();
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-seg_stats.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ test_that("QC: outlier checks can be identified based on a data.frame with regio


test_that("QC: outlier checks can be computed based on an atlas for both hemis.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
fsbrain::download_optional_data();
subjects_dir = fsbrain::get_optional_data_filepath("subjects_dir");
Expand Down
8 changes: 8 additions & 0 deletions tests/testthat/test-vis.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# You can run them by copying & pasting the code into an R session. Treat it as examples.

test_that("We can visualize morphometry data from different views.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires X11.");

Expand Down Expand Up @@ -35,6 +36,7 @@ test_that("We can visualize morphometry data from different views.", {


test_that("We can visualize annotation atlas data.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires X11.");

Expand All @@ -51,6 +53,7 @@ test_that("We can visualize annotation atlas data.", {


test_that("We can visualize arbitrary data on a subjects surface.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires X11.");

Expand All @@ -71,6 +74,7 @@ test_that("We can visualize arbitrary data on a subjects surface.", {


test_that("We can visualize arbitrary data on the fsaverage surfaces if available.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires X11.");

Expand Down Expand Up @@ -123,6 +127,7 @@ test_that("We can visualize one value per atlas region on a subject.", {


test_that("We can visualize one value per Desikan atlas region on fsaverage.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires X11.");

Expand Down Expand Up @@ -157,6 +162,7 @@ test_that("We can visualize one value per Desikan atlas region on fsaverage.", {


test_that("We can visualize a subset of the regions of the Desikan atlas on fsaverage.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.has.fsaverage(), "This test requires fsaverage.");

Expand Down Expand Up @@ -189,6 +195,7 @@ test_that("We can visualize a subset of the regions of the Desikan atlas on fsav


test_that("We can visualize clusters on fsaverage with a background.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.has.freesurfer() & box.has.fsaverage(), "This test requires the full fsaverage subject with curv data.");

Expand Down Expand Up @@ -249,6 +256,7 @@ test_that("We can retrieve vertex counts for a subject.", {


test_that("We can visualize meshes using vis.fs.surface as expected.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");

fsbrain::download_optional_data();
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-vis_group.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

test_that("Visualizing a single image for a group of subjects works for native space morph data.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
fsbrain::download_optional_data();
subjects_dir = fsbrain::get_optional_data_filepath("subjects_dir");
Expand Down
9 changes: 9 additions & 0 deletions tests/testthat/test-vis_multiview.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# You may want to set a globale default for windowrect, e.g.: `library('rgl'); r3dDefaults$windowRect <- c(50,50, 800, 800);`

test_that("We can visualize morphometry data in multiview.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires the full test data and X11.");

Expand Down Expand Up @@ -58,6 +59,7 @@ test_that("We can visualize morphometry data in multiview.", {


test_that("We can visualize p values or other arbitrary data, one value per atlas region.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires the full test data and X11.");
fsbrain::download_optional_data();
Expand Down Expand Up @@ -111,6 +113,7 @@ test_that("We can visualize data on fsaverage if available", {


test_that("We can visualize data on fsaverage3 if available", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
fsbrain::download_fsaverage3(accept_freesurfer_license = TRUE);
subjects_dir = fsbrain::get_optional_data_filepath("subjects_dir");
Expand All @@ -124,6 +127,7 @@ test_that("We can visualize data on fsaverage3 if available", {


test_that("We can record a gif movie of a rotating brain.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(run.extralong.tests(), "This test takes ages.");

Expand Down Expand Up @@ -165,6 +169,7 @@ test_that("We can record a gif movie of a rotating brain.", {


test_that("A label can be visualized.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.has.x11display(), "This test requires X11.");

Expand All @@ -182,6 +187,7 @@ test_that("A label can be visualized.", {
})

test_that("A region from an atlas can be converted to a label and visualized.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires the full test data and X11.");
subjects_dir = testdatapath.subjectsdir.full.subject1();
Expand Down Expand Up @@ -220,6 +226,7 @@ test_that("A region from an atlas can be converted to a label and visualized.",


test_that("We can visualize label data or arbitrary sets of vertices.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires the full test data and X11.");
subjects_dir = testdatapath.subjectsdir.full.subject1();
Expand Down Expand Up @@ -248,6 +255,7 @@ test_that("We can visualize label data or arbitrary sets of vertices.", {


test_that("We can combine an output view with a separate colormap.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(run.extralong.tests(), "This test requires the full test data and X11, and takes ages.");
subjects_dir = testdatapath.subjectsdir.full.subject1();
Expand Down Expand Up @@ -337,6 +345,7 @@ test_that("We can combine an output view with a separate colormap.", {


test_that("We can construct a tight layout image by merging several sd views.", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires X11 and imagemagick.");

Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-vis_volume.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
test_that("A brain volume can be turned into an animation", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(run.extralong.tests(), "This test requires the full test data and X11, and takes ages.");

Expand Down Expand Up @@ -118,6 +119,7 @@ test_that("Axes are derived from a plane definition as expected", {


test_that("A brain volume and an overlay can be merged", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires X11 and the 'magick' package (ImageMagick for R).");

Expand Down Expand Up @@ -204,6 +206,7 @@ test_that("Intensity integer to RGB color string conversion works in 1, 2, and 3


test_that("A brain volume can be visualized as a lightbox colored from the aseg", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires X11, the 'magick' package (ImageMagick for R), and extra data.");

Expand Down
10 changes: 10 additions & 0 deletions tests/testthat/test-vis_volume_3d.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@


test_that("A brain volume or parts of it can be rendered in voxel mode", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires X11 and all test data.");

Expand Down Expand Up @@ -38,6 +39,7 @@ test_that("A brain volume or parts of it can be rendered in voxel mode", {


test_that("A test volume or parts of it can be rendered in voxel mode", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
myvol = gen.test.volume(c(40, 40, 40), bg = NA);
volvis.voxels(myvol, render_every = 10);
volvis.voxels(myvol, render_every = 10, voxelcol = "blue");
Expand All @@ -50,13 +52,15 @@ test_that("A test volume or parts of it can be rendered in voxel mode", {


test_that("The voxel hull can be computed from a volume", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
myvol = gen.test.volume(c(25, 25, 25), bg = NA);
vh = vol.hull(myvol);
testthat::expect_equal(dim(myvol), dim(vh));
})


test_that("The voxel contour can be visualized for a volume", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
myvol = gen.test.volume(c(25, 25, 25), bg = 1L);
volvis.contour(myvol);
testthat::expect_equal(dim(myvol), c(25,25,25)); # add a check to prevent skip
Expand All @@ -66,13 +70,15 @@ test_that("The voxel contour can be visualized for a volume", {


test_that("The voxel contour can be visualized for a volume", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
centers = matrix(rnorm(500*3)*100, ncol=3);
rglvoxels(centers, voxelcol="red");
rglvoxels(centers);
testthat::expect_equal(1L, 1L); # add a check to prevent skip
})

test_that("A brain volume segmentation can be rendered with correct colors from the aseg", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires X11, an aseg.mgz file for the demo subject and the FreeSurferColorLUT.");

Expand Down Expand Up @@ -114,6 +120,7 @@ test_that("A brain volume segmentation can be rendered with correct colors from


test_that("Brain structures can be rendered as contours using misc3d", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires X11, the misc3d package, and an aseg.mgz file for the demo subject.");

Expand Down Expand Up @@ -156,6 +163,7 @@ test_that("Brain structures can be rendered as contours using misc3d", {


test_that("The pial surface drawn as a transparent wrapping over the white surface", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires X11 and extra data.");

Expand All @@ -176,6 +184,7 @@ test_that("The pial surface drawn as a transparent wrapping over the white surfa


test_that("Voxels can be rotated and rendered in a brainview", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires X11.");
fsbrain::download_optional_data();
Expand All @@ -194,6 +203,7 @@ test_that("Voxels can be rotated and rendered in a brainview", {


test_that("A misc3d contour (Triangles3D instance) can be rotated and rendered in a brainview", {
testthat::skip_on_cran(); # CRAN maintainers asked me to reduce test time on CRAN by disabling unit tests.
skip_if(tests_running_on_cran_under_macos(), message = "Skipping on CRAN under MacOS, required test data cannot be downloaded.");
skip_if_not(box.can.run.all.tests(), "This test requires X11.");
fsbrain::download_optional_data();
Expand Down

0 comments on commit 733ddb2

Please sign in to comment.