pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/devel/R-testthat (devel/R-testthat) Updated 2.3.2 to 3...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/60880fa06cc8
branches:  trunk
changeset: 443472:60880fa06cc8
user:      mef <mef%pkgsrc.org@localhost>
date:      Mon Dec 14 03:45:41 2020 +0000

description:
(devel/R-testthat) Updated 2.3.2 to 3.0.0

# testthat 3.0.0

## 3rd edition

testhat 3.0.0 brings with it a 3rd edition that makes a number of breaking
changes in order to clean up the interface and help you use our latest
recommendations. To opt-in to the 3rd edition for your package, set
`Config/testthat/edition: 3` in your `DESCRIPTION` or use `local_edition(3)` in
individual tests. You can retrieve the active edition with `edition_get()`.
Learn more in `vignette("third-edition")`.

* `context()` is deprecated.

* `expect_identical()` and `expect_equal()` use `waldo::compare()` to
   compare actual and expected results. This mostly yields much more
   informative output when the actual and expected values are different,
   but while writing it uncovered some bugs in the existing comparison
   code.

* `expect_error()`, `expect_warning()`, `expect_message()`, and
  `expect_condition()` now all use the same underlying logic: they
  capture the first condition that matches `class`/`regexp` and
  allow anything else to bubble up (#998/#1052). They also warn if
  there are unexpected arguments that are never used.

* The `all` argument to `expect_message()` and `expect_warning()` is now
  deprecated. It was never a particularly good idea or well documented,
  and is now superseded by the new condition capturing behaviour.

* `expect_equivalent()`, `expect_reference()`, `expect_is()` and
  `expect_that()` are deprecated.

* Messages are no longer automatically silenced. Either use
  `suppressMessages()` to hide unimportant messages, or
  `expect_messsage()` to catch important messages (#1095).

* `setup()` and `teardown()` are deprecated in favour of test fixtures.
  See `vignette("test-fixtures")` for more details.

* `expect_known_output()`, `expect_known_value()`, `expect_known_hash()`,
  and `expect_equal_to_reference()` are all deprecated in favour of
  `expect_snapshot_output()` and `expect_snapshot_value()`.

* `test_that()` now sets a number of options and env vars to make output as
  reproducible as possible (#1044). Many of these options were previously
  set in various places (in `devtools::test()`, `test_dir()`, `test_file()`,
  or `verify_output()`) but they have now been centralised. You can use in
  your own code, or when debugging tests interactively with
  `local_test_context()`.

* `with_mock()` and `local_mock()` are deprecated; please use the mockr
  or mockery packages instead (#1099).

## Snapshot testing

New family of snapshot expectations (`expect_snapshot()`, `expect_snapshot_output()`, `expect_snapshot_error()`, and `expect_snapshot_value()`) provide "snapshot" tests, where the expected results 
are stored in separate files in `test/testthat/_snaps`. They're useful whenever it's painful to store expected results directly in the test files.

`expect_snapshot_file()` along with `snapshot_review()` help snapshot
more complex data, with initial support for text files, images, and data frames (#1050).

See `vignette("snapshotting")` for more details.

## Reporters

* `CheckReporter` (used inside R CMD check) now prints out all problems
  (i.e. errors, failures, warnings and skips; and not just the first 10),
  lists skips types, and records problems in machine readable format in
  `tests/testthat-problems.rds` (#1075).

* New `CompactProgressReporter` tweaks the output of `ProgressReporter` for
  use with a single file, as in `devtools::test_file()`. You can pick a
  different default by setting `testthat.default_compact_reporter` to
  the name of a reporter.

* `ProgressReporter` (the default reporter) now keeps the stack traces of
  an errors that happen before the before test, making problems substantially
  easier to track down (#1004). It checks if you've exceeded the maximum number
  of failures (from option `testthat.progress.max_fails`) after each
  expectation, rather than at the end of each file (#967). It also gains
  new random praise options that use emoji, and lists skipped tests by type
  (#1028).

* `StopReporter` adds random praise emoji when a single test passes (#1094).
  It has more refined display of failures, now using the same style
  as `CompactProgressReporter` and `ProgressReporter`.

* `SummaryReporter` now records file start, not just context start. This
  makes it more compatible with modern style which does not use `context()`
  (#1089).

* All reporters now use exactly the same format when reporting the location
  of an expectation.

* Warnings now include a backtrace, making it easier to figure
  out where they came from.

* Catch C++ tests now provide detailed results for each test.
  To upgrade existing code, re-run `testthat::use_catch()` (#1008).

## Fixures

* New `vignette("test-fixtures")` describes test fixtures; i.e. how to
  temporarily and cleanly change global state in order to test parts of
  your code that otherwise would be hard to run (#1042). `setup()` and
  `teardown()` are superseded in favour of test fixtures.

* New `teardown_env()` for use with `withr::defer()`. This allows you to
  run code after all other tests have been run.

## Skips

* New `vignette("skipping")` gives more general information on skipping
  tests, include some basics on testing skipping helpers (#1060).

* `ProgressReporter()` and `CheckReporter()` list the number of skipped tests
  by reason at the end of the reporter. This makes it easier to check that
  you're not skipping the wrong tests, particularly on CI services (#1028).

## Test running

* `test_that()` no longer triggers an error when run outside of tests;
  instead it produces a more informative summary of all failures, errors,
  warnings, and skips that occurred inside the test.

* `test_that()` now errors if `desc` is not a string (#1161).

* `test_file()` now runs helper, setup, and teardown code, and has the
  same arguments as `test_dir()` (#968). Long deprecated `encoding` argument
  has been removed.

* `test_dir()` now defaults `stop_on_failure` to `TRUE` for consistency with
  other `test_` functions. The `wrap` argument has been deprecated; it's not
  clear that it should ever have been exposed.

* New `test_local()` tests a local source package directory. It's equivalent
  to `devtools::test()` but doesn't require devtools and all its dependencies
  to be installed (#1030).

## Minor improvements and bug fixes

* testthat no longer supports tests stored in `inst/tests`. This has been
  deprecated since testthat 0.11.0 (released in 2015). `test_package()`
  (previously used for running tests in R CMD check) will fail silently
  if no tests are found to avoid breaking old packages on CRAN (#1149).

* `capture_output()` and `verify_output()` use a new `testthat_print()`
  generic. This allows you to control the printed representation of your
  object specifically for tests (i.e. if your usual print method shows
  data that varies in a way that you don't care about for tests) (#1056).

* `context_start_file()` is now exported for external reporters (#983, #1082).
  It now only strips first instance of prefix/suffix (#1041, @stufield).

* `expect_error()` no longer encourages you to use `class`. This advice
  one type of fragility at the expense of creating a different type (#1013).

* `expect_known_failure()` has been removed. As far as I can tell it was
  only ever used by testthat, and is rather fragile.

* `expect_true()`, `expect_false()`, and `expect_null()` now use waldo to
  produce more informative failures.

* `verify_output()` no longer always fails if output contains a carriage
  return character ("\r") (#1048). It uses the `pdf()` device instead of
  `png()` soit work on systems without X11 (#1011). And it uses
  `waldo::compare()` to give more informative failures.

diffstat:

 devel/R-testthat/Makefile |  11 +++++++++--
 devel/R-testthat/distinfo |  10 +++++-----
 2 files changed, 14 insertions(+), 7 deletions(-)

diffs (44 lines):

diff -r 04174ea55773 -r 60880fa06cc8 devel/R-testthat/Makefile
--- a/devel/R-testthat/Makefile Mon Dec 14 03:35:23 2020 +0000
+++ b/devel/R-testthat/Makefile Mon Dec 14 03:45:41 2020 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.6 2020/09/20 03:28:16 mef Exp $
+# $NetBSD: Makefile,v 1.7 2020/12/14 03:45:41 mef Exp $
 
 R_PKGNAME=     testthat
-R_PKGVER=      2.3.2
+R_PKGVER=      3.0.0
 CATEGORIES=    devel
 
 MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
@@ -19,8 +19,15 @@
 DEPENDS+=      R-digest>=0.6.20:../../security/R-digest
 DEPENDS+=      R-ellipsis-[0-9]*:../../math/R-ellipsis
 DEPENDS+=      R-pkgload-[0-9]*:../../devel/R-pkgload
+DEPENDS+=      R-brio-[0-9]*:../../devel/R-brio
+DEPENDS+=      R-waldo-[0-9]*:../../devel/R-waldo
+DEPENDS+=      R-ps>=1.5.0:../../sysutils/R-ps
 
 TEST_DEPENDS+= R-devtools-[0-9]*:../../devel/R-devtools
+TEST_DEPENDS+= R-rematch2-[0-9]*:../../devel/R-rematch2
+TEST_DEPENDS+= R-mockery-[0-9]*:../../devel/R-mockery
+TEST_DEPENDS+= R-diffviewer-[0-9]*:../../www/R-diffviewer
+TEST_DEPENDS+= R-callr>=3.5.0:../../devel/R-callr
 
 USE_LANGUAGES= c c++
 
diff -r 04174ea55773 -r 60880fa06cc8 devel/R-testthat/distinfo
--- a/devel/R-testthat/distinfo Mon Dec 14 03:35:23 2020 +0000
+++ b/devel/R-testthat/distinfo Mon Dec 14 03:45:41 2020 +0000
@@ -1,6 +1,6 @@
-$NetBSD: distinfo,v 1.3 2020/09/20 03:28:16 mef Exp $
+$NetBSD: distinfo,v 1.4 2020/12/14 03:45:41 mef Exp $
 
-SHA1 (R/testthat_2.3.2.tar.gz) = 8419fb1d1cf41e8fb2ceddcec53d3634a8f268a6
-RMD160 (R/testthat_2.3.2.tar.gz) = 719410ac495f20ec8675487225fc51ac258413c6
-SHA512 (R/testthat_2.3.2.tar.gz) = 6b104174887792bd02a5d5b851be91b7ade88f80e690c79e9b272bae9e4b06d684b8718d0dee8266dc14e5d1c9d730822ca2d5e00d67ead6dfd5011d990afe56
-Size (R/testthat_2.3.2.tar.gz) = 249661 bytes
+SHA1 (R/testthat_3.0.0.tar.gz) = 96c76f633e6e9bc383f1276fcf1b63cb90e7a427
+RMD160 (R/testthat_3.0.0.tar.gz) = dcc8bc5cc3367803eef0145ea7a6567a0556293d
+SHA512 (R/testthat_3.0.0.tar.gz) = 2139df3a176fce8b037bb5e2cbf7fa4855a453c4ac21475d6ed4754dde7b0e05c8a9d388e7b517e76e88c9b88003622cd81c4aa5e59f64f75c6c05c78841dc1f
+Size (R/testthat_3.0.0.tar.gz) = 674403 bytes



Home | Main Index | Thread Index | Old Index