Closed nialldavison closed 7 months ago
Hi Niall,
Thanks so much for raising this issue, I'd completely overlooked it. The package is still very much in development but I'm glad you gave it a go.
When I tried to run the tests from your fork I get a fail, basically because if there is no fixtures files then it'll exclude nothing and return an empty vector (see GitHub actions CI checks which I've enabled for your fork).
However, I think I understand the issue you are facing, and have solved this by adding pattern = "\\.R$"
to the list.files
function call. This will only read R files from the list of files.
v_test_file_paths <-
list.files(path = test_folder,
recursive = TRUE,
full.names = TRUE,
pattern = "\\.R$")
I've added in an example .rds file in the fixtures folder to check that this works going forward.
Thanks again, if you could sync from main again soon and see if my solution works for your model that would be great. If it doesn't I can investigate tomorrow.
Kind regards,
Rob
Hi Rob,
Thank you for the quick reply and solution. I hadn't tested the code on projects without a fixtures folder! Can confirm your changes work for my project.
Best wishes, Niall
When trying to run the summarise_model and visualise_project commands on a project, R returned an error stating "invalid multibyte character in parser" for an .rds file found in the testthat/fixtures folder. This folder helps the user to store objects when it’s not practical to make tests entirely self-sufficient.
The error traces to the parse command that is run as part of the find_function_calls_in_file function. I assume that since tests would not be stored within the testthat/fixtures folder, and there is no need to try to parse the .rds files, you can reasonably remove references to these files from this portion of the code.