Skip to content

get devtools::test() running w/o error #8

Closed

Description

@appling

2026 restart

Run devtools::test() to run all tests locally. In re-entering this issue in 2026, my approach will be to focus on getting things running by reducing/commenting out tests at first, then adding more tests only as quickly as I can get them to run automatically. Thus this issue does still include these two bullets from the 2015 plan:

  • Avoid user/developer interaction (this will require changes from some development-phase tests)
  • Avoid producing plots or text output other than testthat output (this will require changes from some development-phase tests)

I'll count this issue as completed when I've achieved:

  1. a short set of tests that run automatically
  2. package-wide updates for changes to tidyverse since 2015

Archived: 2015 plan

Tests should:

  • Test whether the function behavior matches the documentation
  • Cover all probable use cases for a function or file
  • Avoid user/developer interaction (this will require changes from some development-phase tests)
  • Avoid producing plots or text output other than testthat output (this will require changes from some development-phase tests)
  • Contain internal comments where necessary to explain/justify tests
  • Be organized into readable test_that blocks
  • Run reasonably quickly
  • Use only data available within the package and/or reproducibly generated (e.g., through fixed text definitions of the data, or using set.seed() before random data generation)
  • Run cleanly on package tests (Ctrl-Shift-T) and eventually also check (Ctrl-Shift-E)

To do:

Activity

  1. added a commit that references this issue on Jun 7, 2015
  2. aappling-usgs commented on Oct 3, 2026

    @aappling-usgs
    Collaborator

    testthat::test_check() is now an alias for testthat::test_package().

    The help at ?test_pacakge() describes these options:
    • ‘test_local()’ tests a local source package.
    • ‘test_package()’ tests an installed package.
    • ‘test_check()’ checks a package during R CMD check.

    So probably during development I'd mostly want testthat::test_local() now.

  3. aappling-usgs commented on Oct 3, 2026

    @aappling-usgs
    Collaborator

    Initial test run on 10/3/26 - I've created an unversioned temp folder (it's already gitignored), worked with Kiro to create test.txt (an R file, but suffixed .txt so I can attach it to gitlab comments like this one), and ran source('temp/test.txt') to generate test-output-yymmdd-hhmm.txt`. These are attached here.

    The script: test.txt

    This morning's output: test-output-261003-1050.txt

    Tests: 89 | Passed: 50 | Failed: 68 | Errors: 28 | Warnings: 29 | Skipped: 4
    
  4. changed the title [-]get test_check running w/o error[/-] [+]get testthat::test_local running w/o error[/+] on Oct 3, 2026
  5. changed the title [-]get testthat::test_local running w/o error[/-] [+]get devtools::test() running w/o error[/+] on Oct 3, 2026
  6. aappling-usgs commented on Oct 3, 2026

    @aappling-usgs
    Collaborator

    Results after implementing Phase 1 of the kiro task list (see #254 for the kiro requirements/design/task files).

    Phase 1 description from design.md:

    Phase 1 (test suite only): Archive manual/interactive tests through the single expect_manual_OK() helper chokepoint, migrate the per-file filter= exclusions out of tests/testthat.R into in-file testthat skip calls, and restore tests/testthat.R to standard generated boilerplate. No R/ source changes.

    Test results:
    test-output-261003-1138.txt

    Tests: 89 | Passed: 28 | Failed: 56 | Errors: 25 | Warnings: 18 | Skipped: 31
    
  7. aappling-usgs commented on Oct 14, 2026

    @aappling-usgs
    Collaborator

    Calling this complete with a bow on it as of #267 . I've got tidyverse fixes in place (#255) and testthat running smoothly with the helper script in dev/run-tests.R. Its output includes failures and errors, but they're documented now and can be chipped away at over multiple future PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions