Repository navigation
Fix flaky tests failing CRAN Fedora r-devel checks (0.4.1) - #104
Merged
Merged
Conversation
Several tests compared the output of two separate writes. Each write stamps datasetJSONCreationDateTime with the current second, so on a slow machine the two writes could fall in different seconds and the outputs differed. This is what failed the r-devel Fedora clang/gcc checks. - Add local_frozen_datetime() test helper that pins get_datetime(), and use it in the five tests that compare separate writes - Pass a character string to testthat's `info` instead of the compression level number, which current testthat rejects - Require testthat >= 3.1.7 for local_mocked_bindings() - Bump version to 0.4.1, add NEWS entry and resubmission notes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CRAN (Prof Ripley, 2026-10-22) reported test ERRORs for 0.4.0 on
r-devel-linux-x86_64-fedora-clangandr-devel-linux-x86_64-fedora-gcc. The fix is due by 2026-11-12. All other flavors are OK.Root cause: several tests compare the output of two separate writes. Each write stamps
datasetJSONCreationDateTimewith the current second. On the slow Fedora machines, the two writes sometimes fell in different seconds, so the outputs differed. The two flavors failed at different compression levels (1 and 9), which fits a timing flake rather than a zlib problem.The failure surfaced as a confusing error rather than a test failure because the test passed the compression level (a number) to
info, which current testthat rejects.To confirm, I re-ran the suite with every write getting a later timestamp. Five tests failed: the one CRAN hit, two more in
test-dsjc.R, and two intest-write_dataset_json.R. All pass with this change.Changes
tests/testthat/helper-datetime.Rwithlocal_frozen_datetime(), which pins the internalget_datetime()vialocal_mocked_bindings(). The five affected tests call it.test-dsjc.R:info = lvlbecomesinfo = paste("level", lvl).DESCRIPTION: testthat>= 2.1.0becomes>= 3.1.7, the minimum forlocal_mocked_bindings().test-edge-cases.Ralready used it.cran-comments.md.There are no changes to package code.
Checks
NEWS.mdupdatedR CMD check --as-cranrun locally. Tests pass. The incoming-feasibility WARNING was the version (now bumped) and threewiki.cdisc.orgdoc links returning 403, which is probably bot-blocking. Worth checking before resubmitting.🤖 Generated with Claude Code