My testtest tests pass the devtools::test() check but fail the devtools::check() step when developing an R package

I have 3 rds files I use in my testthat tests. the files are in /tests/testthat/testdata/. When I run the tests with devtools::test(), the files can be found. When I use devtools::check(), the files won't be found. I have seen this issue discussed here and here and many other places but all the suggested solutions won't work for me. I tried adding the Sys.setenv(R_TESTS="") line at the top of my "testthat.R" file; I tried using here::here() from the package "here" instead of the , system.file() function, etc. What can I do?

Here is my test:

test_that("the test_arguments() returns errors as it should", {
  x <- readRDS(system.file("tests", "testthat", "testdata", "objectA.rds", package = "package"))
  y <- readRDS(system.file("tests", "testthat", "testdata", "objectB.rds", package = "package"))
  z <- readRDS(here::here("tests", "testthat", "testdata", "objectC.rds", package = "package"))

  expect_error(test_arguments(z, y), "X has to be an object of class SpatialPolygonsDataFrame")
  expect_error(test_arguments(x, z), "y has to be an object of class RasterLayer")
})

And here is the result of the devtools::check():

-- Error (test_user_input.R:3:3): the arguments are of the right class ---------------------
Error: cannot open the connection
Backtrace:
    x
 1. \-base::readRDS(here::here("tests", "testthat", "testdata", "objectA.rds")) test_user_input.R:3:2
 2.   \-base::gzfile(file, "rb")

[ FAIL 1 | WARN 1 | SKIP 0 | PASS 0 ]
Error: Test failures
Execution halted

1 error x | 1 warning x | 1 note x
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum