Up to [cvs.NetBSD.org] / pkgsrc / devel / R-testthat
Request diff between arbitrary revisions
Default branch: MAIN
Revision 1.16 / (download) - annotate - [select for diffs], Tue Aug 15 05:50:27 2023 UTC (6 weeks, 4 days ago) by mef
Branch: MAIN
CVS Tags: pkgsrc-2023Q3-base,
pkgsrc-2023Q3,
HEAD
Changes since 1.15: +4 -4
lines
Diff to previous 1.15 (colored)
(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)
Revision 1.15 / (download) - annotate - [select for diffs], Sun Jun 18 13:59:10 2023 UTC (3 months, 1 week ago) by mef
Branch: MAIN
CVS Tags: pkgsrc-2023Q2-base,
pkgsrc-2023Q2
Changes since 1.14: +4 -4
lines
Diff to previous 1.14 (colored)
(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.
Revision 1.14 / (download) - annotate - [select for diffs], Sun Jun 4 07:23:58 2023 UTC (3 months, 3 weeks ago) by mef
Branch: MAIN
Changes since 1.13: +4 -4
lines
Diff to previous 1.13 (colored)
(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).
Revision 1.13 / (download) - annotate - [select for diffs], Sat Dec 31 12:41:06 2022 UTC (8 months, 4 weeks ago) by mef
Branch: MAIN
CVS Tags: pkgsrc-2023Q1-base,
pkgsrc-2023Q1
Changes since 1.12: +4 -4
lines
Diff to previous 1.12 (colored)
(devel/R-testthat) Updated 3.1.5 to 3.1.6 # testthat 3.1.6 * The embedded version of Catch no longer uses `sprintf()`.
Revision 1.12 / (download) - annotate - [select for diffs], Sat Dec 17 03:28:15 2022 UTC (9 months, 2 weeks ago) by mef
Branch: MAIN
CVS Tags: pkgsrc-2022Q4-base,
pkgsrc-2022Q4
Changes since 1.11: +4 -4
lines
Diff to previous 1.11 (colored)
(devel/R-testthat) Updated 3.1.4 to 3.1.5 # testthat 3.1.5 * Deprecation warnings are no longer captured by `expect_warning(code, NA)`, `expect_no_warning(code)`, or `expect_silent(code)`. This ensures that they bubble up to the top level so that you can address them (#1680). If you want to assert that code does not throw a deprecation warning, use `expect_no_condition(code(), class = "lifecycle_warning_deprecation")`. * New experimental `expect_no_error()`, `expect_no_warning()`, `expect_no_message()`, and `expect_no_condition()` for asserting the code runs without an error, warning, message, or condition (#1679). * Fixed a warning in R >=4.2.0 on Windows that occurred when using the C++ testing infrastructure that testthat provides (#1672). * Fixed an issue that could prevent compilation of Catch unit tests with LLVM 15. In the interim, packages needing a local workaround can set `PKG_CPPFLAGS = -DCATCH_CONFIG_CPP11_NO_SHUFFLE` in their `src/Makevars`. (@kevinushey, #1687) * Improve way `capture_output()` handles encoding thanks to suggestion from Kurt Hornik (#1693). This means that snapshots using UTF-8 encoded text on windows work once again. * `local_reproducible_output()` will no longer attempt to set the local language when `LANG='C'` is set or an R version is used that was not compiled with natural language support (NLS), which would previously emit non-test-related warnings during testing (@dgkf, #1662; @heavywatal, #1689). * `test_check()` now suppresses hyperlinks since they'll take you to the wrong places (#1648). * New `set_max_fails()` helper to make it easier to set the maximum number of failures before stopping the test suite. And the advice to set to Inf is now clickable (#1628). * You can now configure the behaviour of the implicit `devtools::load_all()` call performed by `devtools::test()` in your package DESCRIPTION file (#1636). To disable exports of internal functions and of testthat helpers, use: ``` Config/testthat/load-all: list(export_all = FALSE, helpers = FALSE) ``` Helpers are now attached on the search path by default after calling `devtools::test()`.
Revision 1.11 / (download) - annotate - [select for diffs], Mon May 2 14:42:48 2022 UTC (16 months, 4 weeks ago) by mef
Branch: MAIN
CVS Tags: pkgsrc-2022Q3-base,
pkgsrc-2022Q3,
pkgsrc-2022Q2-base,
pkgsrc-2022Q2
Changes since 1.10: +4 -4
lines
Diff to previous 1.10 (colored)
(devel/R-testthat) Updated 3.1.3 to 3.1.4 # testthat 3.1.4 * Minor tweaks to output for latest cli (#1606).
Revision 1.10 / (download) - annotate - [select for diffs], Sat Apr 23 12:43:35 2022 UTC (17 months, 1 week ago) by mef
Branch: MAIN
Changes since 1.9: +4 -4
lines
Diff to previous 1.9 (colored)
(devel/R-testthat) Updated 3.0.4 to 3.1.3 # testthat 3.1.3 * Package that explicitly depend on rlang in their description file are now opting into a new snapshot display for errors, warnings, and messages. Previously this only concerned packages that explicitly depended on rlang >= 1.0.0. This display will eventually become the default for all packages. Changes include: - Condition classes are no longer included in the snapshot by default. This is to avoid snapshot noise when upstream code adds or changes a class. For instance, r-devel has added classes to base errors. - Warnings and errors are now printed with rlang, including the `call` field. This makes it easy to monitor the full appearance of warning and error messages as they are displayed to users. This change is part of a push towards mentioning the useful context of an error as part of messages, see the release notes of rlang 1.0.0 for more about this. * Test results show hyperlinks to failed expectation when supported (#1544). # testthat 3.1.2 * testthat now uses brio for all reading and writing (#1120). This ensures that snapshots always use "\n" to separate lines (#1516). * `expect_snapshot()` no longer inadvertently trims trailing new lines off of errors and messages (#1509). * If `expect_snapshot()` generates a snapshot with different value but still compares as equal (e.g. because you've set a numeric tolerance), the saved values no longer update if another snapshot in the same file changes. * `expect_snapshot()` now only adds a `.new` file for the variants that actually changed, not all variants, while `expect_snapshot_file()` with variant with no longer immediately deletes `.new` files (#1468). * `expect_snapshot_file()` gains a `transform` argument to match `expect_snapshot()` (#1474). `compare` now defaults to `NULL`, automatically guessing the comparison type based on the extension. * `expect_snapshot_file()` now errors if the file being snapshot does not exist; `SnapshotReporter` also now treats the file directory as an absolute path (#1476, @malcolmbarrett) * New `expect_snapshot_warning()` to match `expect_snapshot_error()` (#1532). * `JUnitReporter` now includes skip messages/reasons (@rfineman, #1507) * `local_reproducible_output()` gains a `lang` argument so that you can optionally override the language used to translate error messages (#1483). It also sets the global option `cli.num_colors` in addition to `crayon.enabled`. * `test_that()` no longer inappropriately skips when calling `expect_equal()` when you've temporarily set the locale to non-UTF-8 (#1285). * `skip_if_offline()` now automatically calls `skip_on_cran()` (#1479). * `snapshot_accept()` and `snapshot_review()` now work with exactly the same file specification which can be a snapshot name, a file name, or a directory (#1546). They both work better with variants (#1508). Snapshot cleanup also removes all empty directories (#1457). * When a snapshot changes the hint also mentions that you can use `snapshot_review()` (#1500, @DanChaltiel) and the message tells you what variant is active (#1540). * JUnit reporter now includes skip messages/reasons (@rfineman, #1507). # testthat 3.1.1 * Condition expectations like `expect_error()` now match across the ancestry of chained errors (#1493). You can disable this by setting the new `inherit` argument to `FALSE`. * Added preliminary support for rlang 1.0 errors. It is disabled by default for the time being. To activate it, specify `rlang (>= 1.0.0)` in your `DESCRIPTION` file (or `>= 0.99.0.9001` if you're using the dev version). Once activated, snapshots will now use rlang to print error and warning messages, including the `Error:` and `Warning:` prefixes. This means the `call` field of conditions is now displayed in snapshots if present. Parent error messages are also displayed. Following this change, all snapshots including error and warning messages need to be revalidated. We will enable the new rlang 1.0 output unconditionally in a future release. * `expect_snapshot()` gains a new argument `cnd_class` to control whether to show the class of errors, warnings, and messages. The default is currently unchanged so that condition classes keep being included in snapshots. However, we plan to change the default to `FALSE` in an upcoming release to prevent distracting snapshot diffing as upstream packages add error classes. For instance, the development version of R is currently adding classes to basic errors, which causes spurious snapshot changes when testing against R-devel on CI. If you depend on rlang 1.0 (see above), the default is already set to `FALSE`. * `expect_snapshot()` no longer processes rlang injection operators like `!!`. * Fixed bug in expectations with long inputs that use `::` (#1472). # testthat 3.1.0 ## Snapshot tests * `expect_snapshot()` is no longer experimental. * `expect_snapshot()` and friends gets an experimental new `variant` argument which causes the snapshot to be saved in `_snaps/{variant}/{test}.md` instead of `_snaps/{test}.md`. This allows you to generate (and compare) unique snapshots for different scenarios like operating system or R version (#1143). * `expect_snapshot()` gains a `transform` argument, which should be a function that takes a character vector of lines and returns a modified character vector of lines. This makes it easy to remove sensitive (e.g. API keys) or stochastic (e.g. random temporary directory names) from snapshot output (#1345). * `expect_snapshot_file()` now replaces previous `.new` snapshot if code fails again with a different value. * `expect_snapshot_value()` now has an explicit `tolerance` argument which uses the testthat default, thus making it more like `expect_equal()` rather than `expect_identical()`. Set it to `NULL` if you want precise comparisons (#1309). `expect_snapshot_value(style = "deparse")` now works with negative values (#1342). * If a test containing multiple snapshots fails (or skips) in between snapshots, the later snapshots are now silently restored. (Previously this warned and reset all snapshots, not just later snapshots). * If you have multiple tests with the same name that use snapshots (not a good idea), you will no longer get a warning. Instead the snapshots will be aggregated across the tests. ## Breaking changes * Condition expectations now consistently return the expected condition instead of the return value (#1371). Previously, they would only return the condition if the return value was `NULL`, leading to inconsistent behaviour. This is a breaking change to the 3rd edition. Where you could previously do: ``` expect_equal(expect_warning(f(), "warning"), "value") ``` You must now use condition expectations on the outside: ``` expect_warning(expect_equal(f(), "value"), "warning") # Equivalently, save the value before inspection expect_warning(value <- f(), "warning") expect_equal(value, "value") ``` This breaking change makes testthat more consistent. It also makes it possible to inspect both the value and the warning, which would otherwise require additional tools. ## Minor improvements and bug fixes * Errors in test blocks now display the call if stored in the condition object (#1418). Uncaught errors now show their class (#1426). * Multi-line skips only show the first line in the skip summary. * `expr_label()`, which is used to concisely describe expressions used in expectations, now does a better job of summarising infix function (#1442). * `local_reproducible_output()` now sets the `max.print` option to 99999 (the default), so your tests are unaffected by any changes you might've made in your `.Rprofile` (1367). * `ProgressReporter` (the default only) now stops at the end of a file; this ensures that you see the results of all related tests, and ensures that snapshots are handled consistently (#1402). * `ProgressReporter` now uses an env var to adjust the maximum number of failures. This makes it easier to adjust when the tests are run in a subprocess, as is common when using RStudio (#1450). * `skip_on_os()` gains an `arch` argument so you can also choose to skip selected architectures (#1421). * `test_that()` now correctly errors when an expectation fails when run interactively (#1430). * `test_that()` now automatically and correctly generate an "empty test" skip if it only generates warnings or messages (and doesn't contain any expectations). * `testthat_tolerance()` no longer has an unused argument.
Revision 1.9 / (download) - annotate - [select for diffs], Tue Oct 26 10:14:09 2021 UTC (23 months ago) by nia
Branch: MAIN
CVS Tags: pkgsrc-2022Q1-base,
pkgsrc-2022Q1,
pkgsrc-2021Q4-base,
pkgsrc-2021Q4
Changes since 1.8: +2 -2
lines
Diff to previous 1.8 (colored)
archivers: Replace RMD160 checksums with BLAKE2s checksums All checksums have been double-checked against existing RMD160 and SHA512 hashes Could not be committed due to merge conflict: devel/py-traitlets/distinfo The following distfiles were unfetchable (note: some may be only fetched conditionally): ./devel/pvs/distinfo pvs-3.2-solaris.tgz ./devel/eclipse/distinfo eclipse-sourceBuild-srcIncluded-3.0.1.zip
Revision 1.8 / (download) - annotate - [select for diffs], Thu Oct 7 13:39:03 2021 UTC (23 months, 3 weeks ago) by nia
Branch: MAIN
Changes since 1.7: +1 -2
lines
Diff to previous 1.7 (colored)
devel: Remove SHA1 hashes for distfiles
Revision 1.7 / (download) - annotate - [select for diffs], Tue Aug 17 15:25:42 2021 UTC (2 years, 1 month ago) by mef
Branch: MAIN
CVS Tags: pkgsrc-2021Q3-base,
pkgsrc-2021Q3
Changes since 1.6: +5 -5
lines
Diff to previous 1.6 (colored)
(devel/R-testthat) Updated 3.0.2 to 3.0.4 # testthat 3.0.4 * The vendored Catch code used for `use_catch()` now uses an constant value for the stack size rather than relying on SIGSTKSZ. This fixes compatibility for recent glibc versions where SIGSTKSZ is no longer a constant. * Fixed an issue that caused errors and early termination of tests on R <= 3.6 when a failing condition expectation was signalled inside a snapshot. # testthat 3.0.3 * `expect_snapshot_file()` gains a `compare` argument (#1378, @nbenn). This is a customisation point for how to compare old and new snapshot files. The functions `compare_file_binary()` and `compare_file_text()` are now exported from testthat to be supplied as `compare` argument. These implement the same behaviour as the old `binary` argument which is now deprecated. * `expect_snapshot()` no longer deletes snapshots when an unexpected error occurs. * New `announce_snapshot_file()` function for developers of testthat extensions. Announcing a snapshot file allows testthat to preserve files that were not generated because of an unexpected error or a `skip()` (#1393). Unannounced files are automatically deleted during cleanup if the generating code isn't called. * New expectation: `expect_no_match()`. It complements `expect_match()` by checking if a string **doesn't match** a regular expression (@michaelquinn32, #1381). * Support setting the testthat edition via an environment variable (`TESTTHAT_EDITION`) as well (@michaelquinn32, #1386).
Revision 1.6 / (download) - annotate - [select for diffs], Sun Jun 6 13:11:49 2021 UTC (2 years, 3 months ago) by mef
Branch: MAIN
CVS Tags: pkgsrc-2021Q2-base,
pkgsrc-2021Q2
Changes since 1.5: +5 -5
lines
Diff to previous 1.5 (colored)
(devel/R-testthat) Updated 3.0.1 to 3.0.2 # testthat 3.0.2 * Failing expectations now include a backtrace when they're not called directly from within `test_that()` but are instead wrapped in some helper function (#1307). * `CheckReporter` now only records warnings when not on CRAN. Otherwise failed CRAN revdep checks tend to be cluttered up with warnings (#1300). It automatically cleans up `testthat-problems.rds` left over from previous runs if the latest run is succesful (#1314). * `expect_s3_class()` and `expect_s4_class()` can now check that an object _isn't_ an S3 or S4 object by supplying `NA` to the second argument (#1321). * `expect_s3_class()` and `expect_s4_class()` format class names in a less confusing way (#1322).
Revision 1.5 / (download) - annotate - [select for diffs], Fri Jan 1 04:28:36 2021 UTC (2 years, 8 months ago) by mef
Branch: MAIN
CVS Tags: pkgsrc-2021Q1-base,
pkgsrc-2021Q1
Changes since 1.4: +5 -5
lines
Diff to previous 1.4 (colored)
(devel/R-testthat) Updated 3.0.0 to 3.0.1 # testthat 3.0.1 * New `testthat.progress.verbose_skips` option. Set to `FALSE` to stop reporting skips as they occur; they will still appear in the summary (#1209, @krlmlr). * `CheckReporter` results have been tweaked based on experiences from running R CMD check on many packages. Hopefully it should now be easier to see the biggest problems (i.e. failures and errors) while still having skips and warnings available to check if needed (#1274). And now the full test name is always shown, no matter how long (#1268). * Catch C++ tests are no longer reported multiple times (#1237) and are automatically skipped on Solaris since Catch is not supported (#1257). `use_catch()` makes it more clear that your package needs to suggest xml2 (#1235). * `auto_test_package()` works once again (@mbojan, #1211, #1214). * `expect_snapshot()` gains new `error` argument which controls whether or not an error is expected. If an unexpected error is thrown, or an expected error is not thrown, `expect_snapshot()` will fail (even on CRAN) (#1200). * `expect_snapshot_value(style = "deparse")` handles more common R data structures. * `expect_snapshot_value()` now passes `...` on to `waldo::compare()` (#1222). * `expect_snapshot_file()` gives a hint as to next steps when a failure occurs in non-interactive environments (with help from @maelle, #1179). `expect_snapshot_*()` gives a more informative hint when you're running tests interactively (#1226). * `expect_snapshot_*()` automatically removes the `_snaps` directory if it's empty (#1180). It also warns if snapshots are discarded because tests have duplicated names (#1278, @krlmlr). * `local_reproducible_output()` now sets the LANGUAGE env var to "en". This matches the behaviour of R CMD check in interactive settings (#1213). It also now unsets RSTUDIO envvar, instead of setting it to 0 (#1225). * `RstudioReporter` has been renamed to `RStudioReporter`. * `skip_if_not()` no longer appends "is not TRUE" to custom messages (@dpprdan, #1247). * `test_that()` now warns (3e only) if code doesn't have braces, since that makes it hard to track the source of an error (#1280, @krlmlr).
Revision 1.4 / (download) - annotate - [select for diffs], Mon Dec 14 03:45:41 2020 UTC (2 years, 9 months ago) by mef
Branch: MAIN
CVS Tags: pkgsrc-2020Q4-base,
pkgsrc-2020Q4
Changes since 1.3: +5 -5
lines
Diff to previous 1.3 (colored)
(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.
Revision 1.3 / (download) - annotate - [select for diffs], Sun Sep 20 03:28:16 2020 UTC (3 years ago) by mef
Branch: MAIN
CVS Tags: pkgsrc-2020Q3-base,
pkgsrc-2020Q3
Changes since 1.2: +5 -5
lines
Diff to previous 1.2 (colored)
(devel/R-testthat) Update 2.3.1 to 2.3.2 # testthat 2.3.2 * Fix R CMD check issues
Revision 1.2 / (download) - annotate - [select for diffs], Sat Feb 15 06:09:00 2020 UTC (3 years, 7 months ago) by mef
Branch: MAIN
CVS Tags: pkgsrc-2020Q2-base,
pkgsrc-2020Q2,
pkgsrc-2020Q1-base,
pkgsrc-2020Q1
Changes since 1.1: +5 -5
lines
Diff to previous 1.1 (colored)
(devel/R-testthat) Updated 2.2.1 to 2.3.1 # testthat 2.3.1 * The last version of testthat introduced a performance regression in error assertions (#963). To fix it, you need to install rlang 0.4.2. * Fixed error assertions with rJava errors (#964). * Fixed issue where error and warning messages were not retrieved with `conditionMessage()` under certain circumstances. # testthat 2.3.0 ## Conditions This release mostly focusses on an overhaul of how testthat works with conditions (i.e. errors, warnings and messages). There are relatively few user-facing changes, although you should now see more informative backtraces from errors and failures. * Unexpected errors are now printed with a simplified backtrace. * `expect_error()` and `expect_condition()` now display a backtrace when the error doesn't conform to expectations (#729). * `expect_error()`, `expect_warning()` and `expect_message()` now call `conditionMessage()` to get the condition message. This generic makes it possible to generate messages at print-time rather than signal-time. * `expect_error()` gets a better warning message when you test for a custom error class with `regexp`. * New `exp_signal()` function is a condition signaller that implements the testthat protocol (signal with `stop()` if the expectation is broken, with a `continue_test` restart). * Existence of restarts is first checked before invokation. This makes it possible to signal warnings or messages with a different condition signaller (#874). * `ListReporter` now tracks expectations and errors, even when they occur outside of tests. This ensures that `stop_on_failure` matches the results displayed by the reporter (#936). * You can silence warnings about untested error classes by implementing a method for `is_uninformative_warning()`. This method should be lazily registered, e.g. with `vctrs::s3_register()`. This is useful for introducing an experimental error class without encouraging users to depend on the class in their tests. * Respect options(warn = -1) to ignore all warnings (@jeroen #958). ## Expectations * Expectations can now be explicitly subclassed with `new_expectation()`. This constructor follows our new conventions for S3 classes and takes an optional subclass and optional attributes. * Unquoted inputs no longer potentially generate multiple test messages (#929). * `verify_output()` no longer uses quasiquotation, which fixes issues when verifying the output of tidy eval functions (#945). * `verify_output()` gains a `unicode` parameter to turn on or off the use of Unicode characters by the cli package. It is disabled by default to prevent the tests from failing on platforms like Windows that don't support UTF-8 (which could be your contributors' or your CI machines). * `verify_output()` now correctly handles multi-line condition messages. * `verify_output()` now adds spacing after condition messages, consistent with the spacing added after normal output. * `verify_output()` has a new syntax for inserting headers in output files: insert a `"# Header"` string (starting with `#` as in Markdown) to add a header to a set of outputs. ## Other minor improvements and bug fixes * `compare.numeric()` uses a more sophisticated default tolerance that will automatically skip tests that rely on numeric tolerance if long doubles are not available (#940). * `JunitReporter` now reports tests in ISO 8601 in the UTC timezone and uses the maximum precision of 3 decimal places (#923).
Revision 1.1 / (download) - annotate - [select for diffs], Fri Aug 9 18:39:07 2019 UTC (4 years, 1 month ago) by brook
Branch: MAIN
CVS Tags: pkgsrc-2019Q4-base,
pkgsrc-2019Q4,
pkgsrc-2019Q3-base,
pkgsrc-2019Q3
R-testthat: initial commit 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'.