./devel/R-testthat, Unit testing for R

[ CVSweb ] [ Homepage ] [ RSS ] [ Required by ] [ Add to tracker ]


Branch: CURRENT, Version: 3.2.2, Package name: R-testthat-3.2.2, Maintainer: pkgsrc-users

Software testing is important, but, in part because it is frustrating
and boring, many of us avoid it. 'testthat' is a testing framework for
R that is easy to learn and use, and integrates with your existing
'workflow'.


Required to run:
[math/R] [devel/R-evaluate] [security/R-digest] [devel/R-magrittr] [devel/R-crayon] [devel/R-R6] [devel/R-cli] [devel/R-rlang] [devel/R-withr] [math/R-ellipsis] [misc/R-praise] [devel/R-pkgload]

Required to build:
[pkgtools/cwrappers]

Master sites: (Expand)


Version history: (Expand)


CVS history: (Expand)


   2024-12-15 05:22:41 by Makoto Fujiwara | Files touched by this commit (2)
Log message:
(devel/R-testthat) Updated 3.2.1.1 to 3.2.2

# testthat 3.2.2

## New expectations

* `expect_s7_class()` tests if an object is an S7 class (#1580).

* `expect_no_failure()`, `expect_no_success()` and `expect_snapshot_failure()`
  provide more options for testing expectations.

## Bug fixes and minor improvements

* testthat now requires waldo 0.6.0 or later to access the latest features
  (#1955).

* `expect_condition()` and related functions now include the `class` of the
  expected condition in the failure message, if provided (#1987).

* `expect_error()` and friends now error if you supply `...` but not `pattern`
  (#1932). They no longer give an uninformative error if they fail inside
  a magrittr pipe (#1994).

* `expect_no_*()` expectations no longer incorrectly emit a passing test result
  if they in fact fail (#1997).

* `expect_setequal()` correctly identifies what is missing where (#1962).

* `expect_snapshot()` now strips line breaks in test descriptions
  (@LDSamson, #1900), and errors when called from a `test_that()` that has an
  empty description (@kevinushey, #1980).

* `expect_true()` and `expect_false()` give better errors if `actual` isn't a
  vector (#1996).

* `expect_visible()` and `expect_invisible()` have clearer failure messages
   (#1966).
* `local_reproducible_output()` (used in `test_that()` blocks) now sets
   `LANGUAGE` to `"C"` instead of `"en"` to disable translations,
   avoiding warnings on some platforms (#1925).

* `skip_if_not_installed()` generates a clearer message that sorts better
   (@MichaelChirico, #1959).

* `with_mock()` and `local_mock()` have been unconditionally deprecated as
  they will no longer work in future versions of R (#1999).
   2024-09-23 01:18:09 by Makoto Fujiwara | Files touched by this commit (2) | Package updated
Log message:
(devel/R-testthat) Updated 3.2.1 to 3.2.1.1, NEWS.md is not updated
   2024-01-08 08:54:46 by Makoto Fujiwara | Files touched by this commit (2)
Log message:
(devel/R-testthat) Updated 3.1.10 to 3.2.1

- Upstream changes:

# testthat 3.2.1

* Fix incorrect format string detected by latest R-devel. Fix thanks to
  Tomas Kalibera.

* `expect_snapshot()` handles unexpected errors like errors outside of
  snapshots, i.e. they terminate the entire test and get a traceback (#1906).

* `JunitReporter()` now uses ensures numeric values are saved the xml file
  with `.` as decimal separator. (@maksymiuks, #1660)

* `local_mocked_bindings()` can now mock any object, not just functions
  (#1896).

* `skip_if_offline()` now uses `captive.apple.com` by default. This is the
  hostname that Apple devices use to check that they're online so it should
  have a higher reliability than `r-project.org` (@jdblischak, #1890).

* `test_file(desc = )` will now find `describe()` tests as well as `test_that()`
  tests (#1903).

# testthat 3.2.0

## Lifecycle changes

* `is_informative_error()` and the `wrap` argument to `test_dir()` and friends
  are now defunct.

* `expect_no_error()`, `expect_no_warning()`, `expect_no_message()`,
  `expect_no_condition()`, `local_mocked_bindings()`, and
  `with_mocked_bindings()` are now stable, not experimental.

## New features

* All packages, regardless of whether or not they use rlang 1.0.0, now
  use the new snapshot display for errors, warnings, and messages (#1856).
  This no longer shows the class name, instead focussing on a display that
  more closely mimics what you'll see interactively, including showing the
  error call.

* testthat uses an improved algorithm for finding the srcref associated with
  an expectation/error/warning/skip. It now looks for the most recent call
  that has known source and is found inside the `test_that()` call. This
  generally gives more specific locations than the previous approach and
  gives much better locations if an error occurs in an exit handler.

## Minor features and bug fixes

* Helpers are no longer run twice.

* `expect_setequal()` correctly displays results when only one of actual and
  expected is missing elements (#1835).

* `expect_snapshot()` and friends no longer create a temporary file on every
  invocation.

* `expect_snapshot_file()` now generates clickable links to review changes
  (#1821).

* `expect_snapshot_value()` has an improved error if the object can't be
  safely serialized using the specified `style` (#1771).

* `options(rlang_interactive = TRUE)` no longer causes `skip_on_cran()` to
  not run on CRAN (#1868).

* `skip_if_offline()` now errors if you don't have curl installed (#1854).

* `StopReporter` gains the ability to suppress praise when a test passes.

* `ProgressReporter` now uses is a two characters wide skip column in order
  to have a consistent width when 10 or more tests are skipped in a single file
  (@mgirlich, #1844).

* `test_file()` gains a `desc` argument which allows you to run a single
  test from a file (#1776).

- pkgsrc changes (etc):

 make test fails as follows

* checking tests ...
  Running 'test-catch.R'
  Running 'testthat.R'
 ERROR
Running the tests in 'tests/testthat.R' failed.
Last 13 lines of output:
  `expected`: "en"

  [ FAIL 2 | WARN 2 | SKIP 123 | PASS 828 ]
   2023-08-15 07:50:28 by Makoto Fujiwara | Files touched by this commit (2)
Log message:
(devel/R-testthat) Updated 3.1.9 to 3.1.10

# testthat 3.1.10

* Fix for upcoming R-devel release.

* `testthat` now sets the `_R_CHECK_BROWSER_NONINTERACTIVE_` environment variable
  when running tests. This should ensure that left-over `browser()` statements
  will trigger an error if encountered while running tests. This functionality
  is only enabled with R (>= 4.3.0). (#1825)
   2023-07-30 15:37:16 by Makoto Fujiwara | Files touched by this commit (1)
Log message:
(devel/R-testthat) Add TEST_DEPENDS+= tex-latex-bin
   2023-06-18 15:59:10 by Makoto Fujiwara | Files touched by this commit (2)
Log message:
(devel/R-testthat) Updated 3.1.8 to 3.1.9

# testthat 3.1.9

* New `expect_contains()` and `expect_in()` that works similarly to
  `expect_true(all(expected %in% object))` or
  `expect_true(all(object %in% expected))` but give more informative failure
  messages (#1346).

* New `is_snapshot()` returns `TRUE` if code is running inside a snapshot test
  (#1796) and `is_checking()` returns `TRUE` if test is running inside of
  `R CMD check` (#1795)

* `ProgressReporter` only reports the run time of test files that take longer
  than 1s, rather than 0.1s. (#1806) and re-displays all failures at the end
  of the results. Skips are now only shown at the end of reporter summaries,
  not as tests are run. This makes them less intrusive in interactive tests
  while still allowing you to verify that the correct tests are skipped (#1801).
  When using parallel tests, links to failed tests (#1787) and links to
  accept/review snapshot (#1802) now work.

* `set_state_inspector()` allows to to register a function that's called
  before and after every test, reporting on any differences. This
  is very useful for detecting if any of your tests have made changes to
  global state (like options, env vars, or connections) (#1674). This
  function was inspired by renv's testing infrastructure.

* `skip_on_cran()` no longer skips (errors) when run interactively.

* `teardown_env()` works in more cases.

* All packages, regardless of whether or not they use rlang, now
  use the new snapshot display for errors, warnings, and messages.

* testthat no longer truncates tracebacks and uses rlang's default tree
  display.
   2023-06-11 04:22:30 by Makoto Fujiwara | Files touched by this commit (1)
Log message:
(devel/R-testthat) Add buildlink3.mk, see wip/R-nloptr
   2023-06-04 09:23:58 by Makoto Fujiwara | Files touched by this commit (2)
Log message:
(devel/R-testthat) Updated 3.1.6 to 3.1.8

# testthat 3.1.8

* `expect_snapshot()` differences no longer use quotes.

* `expect_error()`, `expect_warning()`, and `expect_message()` now correctly
  enforce that the condition is of the expected base class (e.g. error,
  warning, messsage) even when the `class` argument is used (#1168).

* `it()` now calls `local_test_context()` so that it behaves more
  similarly to `test_that()` (#1731), and is now exported so that you
  can more easily run BDD tests interactively (#1587)

* `skip_on_bioc()` now uses the documented environment variable
  (`IS_BIOC_BUILD_MACHINE`) (#1712).

* `source_file()`, which is used by various parts of the helper and
  setup/teardown machinery, now reports the file name in the case of
  errors (#1704).

* `test_path()` now works when called within helper files (#1562).

* New `vignette("special-files")` describes the various special files
  that testthat uses (#1638).

* `with_mocked_bindings()` and `local_mocked_bindings()` now also bind in the
  imports namespace and can mock S3 methods. These changes make them good
  substitutes for the deprecated functions `with_mock()` and `local_mock()`, so
  those older functions now recommend switching to the newer equivalents
  instead of using the mockr or mockery packages.

# testthat 3.1.7

* `expect_setequal()` gives more actionable feedback (#1657).

* `expect_snapshot()` no longer elides new lines when run interactively (#1726).

* Experimental new `with_mocked_bindings()` and `local_mocked_bindings()`
  (#1739).