Ensure attachments path directory is created - #1788
Conversation
cb47ad0 to
aab38cf
Compare
grynspan
left a comment
There was a problem hiding this comment.
This is a lot of new code just to create a directory. I'd suggest we just leverage Foundation for it unless we're doing it a lot. (So, yes, you did the right thing avoiding Foundation, but sometimes it's not worth the effort!)
58f0c81 to
9b7fa6d
Compare
e919a0e to
0388251
Compare
c23543e to
e5321fb
Compare
3777f5e to
f695ef9
Compare
388342c to
538de51
Compare
| let actualPath = try #require(configuration.attachmentsPath, "Attachments path is not expected to be nil") | ||
| #expect(canonicalizePath(actualPath) == canonicalizePath(attachmentsPath)) | ||
| #else | ||
| try Test.cancel("Test requires Foundation") |
There was a problem hiding this comment.
No, just mark the whole block of tests as #if canImport(Foundation) please, as is done elsewhere in our test suites.
There was a problem hiding this comment.
I thought to mark the test skipped to get a sense of which tests were may not have been executed
There was a problem hiding this comment.
Skip a test when it otherwise would run, but some runtime condition prevents it from doing so. If a test is entirely invalid in some configuration, it does not need to exist in that configuration.
Please make this change.
There was a problem hiding this comment.
Done. I wrapped each test in a #if canImport(...) block to prevent adding a test case in between that should not be gated by said canImport. This makes it more explicit which tests should be gated by the #if canImport(...)
There was a problem hiding this comment.
That's not what I asked you to do, but it's sufficient for the purposes of this PR.
89b95d1 to
aa7c501
Compare
When running `swift test --attachments-path /does/not/exist`, the Swift Testing library will fail with an error like: ``` Invalid value "/path/does/not/exists" for argument ---attachments-path ``` Ensure the path specified by `--attachments-path` is created, and update the error message to remote the additional `-` in the argument name. Closes swiftlang#1665
aa7c501 to
97f477b
Compare
When running
swift test --attachments-path /does/not/exist, the Swift Testing library will fail with an error like:Ensure the path specified by
--attachments-pathis created, and update the error message to remote the additional-in the argument name.Closes #1665
Checklist: