Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expect_no_error() doesn't count? #2037

Closed
jonthegeek opened this issue Dec 11, 2024 · 4 comments · Fixed by #2046
Closed

expect_no_error() doesn't count? #2037

jonthegeek opened this issue Dec 11, 2024 · 4 comments · Fixed by #2046

Comments

@jonthegeek
Copy link
Contributor

With testthat 3.2.2, expect_no_error() tests are skipped as "empty test".

library(testthat)
test_that("This definitely isn't empty", {
  expect_no_error({
    mean(1:10)
  })
})
#> ── Skip: This definitely isn't empty ───────────────────────────────────────────
#> Reason: empty test

Created on 2024-12-11 with reprex v2.1.1

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value
#>  version  R version 4.4.2 (2024-10-31 ucrt)
#>  os       Windows 11 x64 (build 26100)
#>  system   x86_64, mingw32
#>  ui       RTerm
#>  language (EN)
#>  collate  English_United States.utf8
#>  ctype    English_United States.utf8
#>  tz       America/Chicago
#>  date     2024-12-11
#>  pandoc   3.2 @ C:/Program Files/RStudio/resources/app/bin/quarto/bin/tools/ (via rmarkdown)
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version date (UTC) lib source
#>  brio          1.1.5   2024-04-24 [1] CRAN (R 4.4.1)
#>  cli           3.6.3   2024-06-21 [1] CRAN (R 4.4.1)
#>  desc          1.4.3   2023-12-10 [1] CRAN (R 4.4.1)
#>  digest        0.6.37  2024-08-19 [1] CRAN (R 4.4.1)
#>  evaluate      1.0.1   2024-10-10 [1] CRAN (R 4.4.1)
#>  fansi         1.0.6   2023-12-08 [1] CRAN (R 4.4.1)
#>  fastmap       1.2.0   2024-05-15 [1] CRAN (R 4.4.1)
#>  fs            1.6.5   2024-10-30 [1] CRAN (R 4.4.1)
#>  glue          1.8.0   2024-09-30 [1] CRAN (R 4.4.1)
#>  htmltools     0.5.8.1 2024-04-04 [1] CRAN (R 4.4.1)
#>  knitr         1.49    2024-11-08 [1] CRAN (R 4.4.2)
#>  lifecycle     1.0.4   2023-11-07 [1] CRAN (R 4.4.1)
#>  magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.4.1)
#>  pillar        1.9.0   2023-03-22 [1] CRAN (R 4.4.1)
#>  pkgload       1.4.0   2024-06-28 [1] CRAN (R 4.4.1)
#>  R6            2.5.1   2021-08-19 [1] CRAN (R 4.4.1)
#>  reprex        2.1.1   2024-07-06 [1] CRAN (R 4.4.1)
#>  rlang         1.1.4   2024-06-04 [1] CRAN (R 4.4.1)
#>  rmarkdown     2.29    2024-11-04 [1] CRAN (R 4.4.1)
#>  rprojroot     2.0.4   2023-11-05 [1] CRAN (R 4.4.1)
#>  rstudioapi    0.17.1  2024-10-22 [1] CRAN (R 4.4.1)
#>  sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.4.1)
#>  testthat    * 3.2.2   2024-12-10 [1] CRAN (R 4.4.2)
#>  utf8          1.2.4   2023-10-22 [1] CRAN (R 4.4.1)
#>  vctrs         0.6.5   2023-12-01 [1] CRAN (R 4.4.1)
#>  waldo         0.6.1   2024-11-07 [1] CRAN (R 4.4.2)
#>  withr         3.0.2   2024-10-28 [1] CRAN (R 4.4.1)
#>  xfun          0.49    2024-10-31 [1] CRAN (R 4.4.1)
#>  yaml          2.3.10  2024-07-26 [1] CRAN (R 4.4.1)
#> 
#>  [1] C:/Users/Jon Harmon/AppData/Local/R/win-library/4.4
#>  [2] C:/Program Files/R/R-4.4.2/library
#> 
#> ──────────────────────────────────────────────────────────────────────────────
jonthegeek added a commit to Gilead-BioStats/gsm.app that referenced this issue Dec 11, 2024
jonthegeek added a commit to Gilead-BioStats/gsm.app that referenced this issue Dec 16, 2024
* Detect package requirements for plugins.

Right now this is fairly manual. I'm working toward automating it more. We'll make the user tell us SOME things, but I'm trying to make it a light lift.

Closes #322.

* See if rsconnect picks up ggplot2 and safetyCharts automatically.

* Another attempt to poke renv to see packages.

* Quick test of dependency-library-er for shiny deployment.

* Load packages on plugin read.

* Function for shinyapps workflow.

* Handle metrics with 0 flags.

If a site doesn't have any flags, display a placeholder GT table. This isn't perfect but it's an easy, stop-gap fix.

To test, update app.R, adding this filter to dfResults: `dfResults = dplyr::filter(gsm.app::sample_dfResults, GroupID != "0X159")`.

* Document and export plugin dependency functions.

* Document and test Plugin dependency functions and other uncovered pieces.

* More documentation.

* Plugins vignette.

* Work around testthat 3.2.2 bug (r-lib/testthat#2037).

* Use standardized function converter. Mostly.

* Explicitly point to release file for gsm.

* Try to make it find gsm 2.2.0.

* Revert to normal gsm & wait.

* Try a specific commit.

* Revert to tag.

This is what I want long-term. Let's use this one and see if we can make it work eventually.

* One more try to pass the time.

* Give shinyapps a GITHUB_PAT.

We might have to supply a "real" PAT (with permissions to read other repos), at least until shinyapps fixes their bug (and it wouldn't hurt to have it in place to protect against future bugs).

* Update shinyapps-deploy.yaml

* Simplify shinyapps workflow.

In theory it should finally work without the gt/gsm hacks.
@orichters
Copy link

orichters commented Dec 30, 2024

Same with expect_no_warning.

test_that("expect_no_warning is not empty", {
  expect_no_warning(a <- 0)
})
── Skip: expect_no_warning is not empty ───
Reason: empty test

Might be caused by #2010, @hadley?

@johnomics
Copy link

All expect_no functions are passing silently. Commit 4e3446c attempts to fix this but it doesn't look like it works - the new tests added to test-expect-no-condition.R in this commit are skipped (using a local clone of the main branch):

> packageVersion("testthat")
[1] ‘3.2.2.9000’
> devtools::test(filter = "expect-no-condition")
ℹ Testing testthat
Starting 1 test process
✔ | F W  S  OK | Context
✔ |      1  18 | expect-no-condition [1.3s]

══ Results ══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
Duration: 3.0 s

── Skipped tests (1) ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
• empty test (1): test-expect-no-condition.R:15:1

[ FAIL 0 | WARN 0 | SKIP 1 | PASS 18 ]

@t-kalinowski
Copy link
Member

Just ran into this as well.

library(testthat)
test_that("expect_no_error", {
  expect_no_error(1+1)
})
#> ── Skip: expect_no_error ───────────────────────────────────────────────────────
#> Reason: empty test

test_that("expect_equal", {
  expect_equal(1+1, 2)
})
#> Test passed 😀

Created on 2025-01-07 with reprex v2.1.1

@hadley
Copy link
Member

hadley commented Jan 8, 2025

Should be fixed now (hopefully without breaking something different). I'll probably do a patch release in the next week or so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants