pharmaverse / pharmaverse/logrx

Fragile tests relying on exact messaging of lintr output

Open
#231 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
HTML
Stars
48
Forks
12
Avg merge
20d 8h
Merged PRs (30d)
1

Description

What happened?

These two tests break under the current development version of R which is in the process of being released to CRAN:

https://github.com/pharmaverse/logrx/blob/f6c24f87829d1d78d63801ab942baf367eb27625/tests/testthat/test-get.R#L181-L189
https://github.com/pharmaverse/logrx/blob/f6c24f87829d1d78d63801ab942baf367eb27625/tests/testthat/test-writer.R#L199-L209

In general, I try and avoid relying on fragile things like "the exact wording of an error message produced by an upstream package".

For example, in {data.table}, we have this list of messages/message factories for test outputs that come directly from {base} R:

https://github.com/Rdatatable/data.table/blob/c29e313dac1de8b959f5e3438c33c0d00873be05/inst/tests/tests.Rraw#L176-L201

I will submit a quick-fix PR shortly, but it's worth thinking through a more robust way to structure these tests going forward.

Session Information

No response

Reproducible Example

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/testthat/test-get.R lines 181-189 and tests/testthat/test-writer.R lines 199-209, then inspect how the tests assert lintr output and compare the upstream-message examples linked in the issue. The work is done when both tests remain valid across the current R release without depending on exact upstream error wording.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
testing-qa
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.