-
Notifications
You must be signed in to change notification settings - Fork 318
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Snapshot file root directory issues #1359
Comments
I now suspect the third issue has to do with these lines: testthat/R/snapshot-reporter.R Lines 77 to 78 in 8821548
I'm assuming that |
What are you trying to do? Those tests don't look anything like what I'd expect. Generally you should be calling |
Oh, sorry, I should have clarified that they didn't necessarily represent my use case. It was just convenient to snapshot local files to show the circumstances under which it was and wasn't working. I bumped into this issue while testing project setup code, similar to what usethis does, e.g. create a project in a temporary directory and work within that directory for the duration of the test. I was trying to snapshot local files created in that process. While I did not necessarily wrap it all in a function, I think the idea was the same: it was a temporary file, and I provided the path to I think the main issues here for me are
The fact that the local directory at the start of the test is in the testthat folder is probably not really an issue, especially if it expects an absolute path to a temp file. |
Ok, I think you're saying that you're changing the working directory in |
Yes, except that |
Hmmm, that's probably because snapshots generated by |
Yes, I'll take a crack at that as soon as I am back from vacation. Thanks! |
@malcolmbarrett I've encountered the exact same issue and this thread (and your PR) made me very happy. 😁 |
Perhaps it's my mental model of
expect_snapshot_file()
that is broken, but I'm having numerous issues related to directory paths. I created a reprex package here: https://github.com/malcolmbarrett/file.snapshot with the relevant test file here: https://github.com/malcolmbarrett/file.snapshot/blob/main/tests/testthat/test-file-snapshot.RHere's a summary of the issues I'm having:
I suspect this is a mixture of intentional and unintentional behavior (and possibly my own misunderstanding!) but unfortunately, I'm not sure which is which.
The text was updated successfully, but these errors were encountered: