rappdirs
rappdirs copied to clipboard
Switch test expect_snapshot to explicit expect_warning
Problem: In recent R versions (not sure when it changed), the format of warnings has changed making the snapshot _snaps/utils.md
incorrect and the test to fail.
This PR switches the test to explicit expect_warning
to catch the warning and then expect_equal
. This way it should pass with any R version.
Please comment or merge.
making the snapshot
_snaps/utils.md
incorrect and the test to fail.
It does not fail for me, on R-4.3.2 or R-devel. OTOH testthat has changed the output slightly, try updating testthat.
I am using testthat 3.2.0 and R 4.3.2 and it fails.
I am thinking it would be better to have more explicit tests, ie not relying on specific output formatting, as proposed in this PR so tests are passing with any versions, past or present.
Since we rely on snapshot tests a lot, it is important to understand why it fails for you if it does not on any of our CI platforms. What is your platform?
I am on Archlinux. I am building packages using the AUR for all R packages.
If you are running R CMD check
, then the snapshot test failures are ignored by default, so it should not be a problem.
But I actually reproduce the failure on Archlinux:
FROM archlinux:latest
WORKDIR /root
RUN pacman -Sy --noconfirm r gcc which git make
RUN git clone https://github.com/r-lib/rappdirs.git
RUN R -q -e 'source("https://pak.r-lib.org/install.R")'
WORKDIR /root/rappdirs
RUN R -q -e 'pak::pkg_install("testthat")'
RUN R -q -e 'testthat::test_local()'