r-universe-org / help

Support and bug tracker for R-universe
https://docs.r-universe.dev/
8 stars 2 forks source link

Skip tests in Runiverse `build package` github action #439

Closed daniellga closed 1 week ago

daniellga commented 1 week ago

Hi!

I have 2 test functions. One that accesses audio drivers and the other that accesses a file from the built package and I am having these 2 tests failure only when building in Runiverse (they don't fail in my github CI or in my PC).

  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test_haudiosink.R:11:7'): haudiosink works. ─────────────────────────
  Error: PlayError: The requested device is no longer available. For example, it has been unplugged.
  Backtrace:
      ▆
   1. └─harmonium (local) haudiosink_from_harray() at test_haudiosink.R:50:5
   2.   └─HAudioSink$new() at test_haudiosink.R:11:7
   3.     └─harmonium:::.savvy_wrap_HAudioSink(.Call(savvy_HAudioSink_new__impl))
  ── Error ('test_hfile.R:9:5'): hfile works. ────────────────────────────────────
     Error: IoError: No such file or directory (os error 2)
  Backtrace:
      ▆
   1. ├─testthat::expect_equal(...) at test_hfile.R:9:5
   2. │ └─testthat::quasi_label(enquo(object), label, arg = "object")
   3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
   4. └─HFile$params(filepath)

  [ FAIL 2 | WARN 0 | SKIP 0 | PASS 142 ]
  Error: Test failures
  Execution halted

So I decided to use skip_on_ci from testthat and it doesn't seem to work here anyway. What would be the correct approach to skip these 2 tests or even make them work?

The GA run: https://github.com/r-universe/daniellga/actions/runs/9635169628/job/26571713435 The repo I am trying to host in R-universe: https://github.com/daniellga/harmonium/

Thanks in advance!

jeroen commented 1 week ago

You can use skip_on_cran() or condition on an environment variable MY_UNIVERSE for example.

daniellga commented 1 week ago

Nice! It worked! Thanks again!