Package check error on OSX in example using rgl

I get a check error on OSX (but not Linux) when running my examples for an example that uses rgl. I get a check message like:

 ERROR
Running examples in ‘piecepackr-Ex.R’ failed
The error most likely occurred in:
> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: piece3d
> ### Title: Draw board game pieces using rgl
> ### Aliases: piece3d
> 
> ### ** Examples
> 
> if (require("rgl") && class(try(rgl.open())) != "try-error") {
+     cfg <- pp_cfg()
+     piece3d("tile_face", suit = 3, rank = 3, cfg = cfg, x = 0, y = 0, z = 0)
+     piece3d("coin_back", suit = 4, rank = 2, cfg = cfg, x = 2, y = 0, z = 0)
+     piece3d("saucer_back", suit = 1, cfg = cfg, x = 2, y = 2, z=-2)
+     piece3d("pawn_face", suit = 2, cfg = cfg, x = 1, y = 1, z = 2)
+ }
  • Is there a way to get the OSX rgl to run correctly and not throw an error

  • Is there anyway to suppress that check other than

    • Wrapping it in \dontbuild and suppress example working for all users
    • Wrapping it in some code that checks if OS is OSX and suppress example working for all OSX users
  • Is there anyway to get the OSX (but not Linux) checks to not check tests wrapped in \donttest?

Thanks,

https://travis-ci.org/github/piecepackr/piecepackr/jobs/685534170

The low-hanging solution is to change the example so we don’t run it if it we are on Travis-CI i.e.

if ((Sys.getenv("TRAVIS") == "") && require("rgl")) {
    open3d()
    cfg <- pp_cfg()
    piece3d("tile_face", suit = 3, rank = 3, cfg = cfg, x = 0, y = 0, z = 0)
    piece3d("coin_back", suit = 4, rank = 2, cfg = cfg, x = 2, y = 0, z = 0)
    piece3d("saucer_back", suit = 1, cfg = cfg, x = 2, y = 2, z=-2)
    piece3d("pawn_face", suit = 2, cfg = cfg, x = 1, y = 1, z = 2)
}

It is important to put the Travis-CI check before the require(rgl) call because require(rgl) seems to cause an error on Travis CI’s OSX build.