Skip to content

Commit 4ba446b

Browse files
authored
stop testArchiveSource from writing files to pacakge root (#3326)
motivation the test "testArchiveSource" has been writing a file to the project's root when invoked from the command line changes: change the test to use a temporary directory instead of current working directory
1 parent 4f8f01a commit 4ba446b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Tests/CommandsTests/PackageToolTests.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,10 +1011,9 @@ final class PackageToolTests: XCTestCase {
10111011
XCTAssert(stdoutOutput.contains("Created Bar-1.2.3.zip"), #"actual: "\#(stdoutOutput)""#)
10121012
}
10131013

1014-
// Runnning with output as relative path,
1015-
// which in execution context is outside package root
1016-
do {
1017-
let destination = RelativePath("Bar-1.2.3.zip")
1014+
// Running with output is outside the package root
1015+
try withTemporaryDirectory { tempDirectory in
1016+
let destination = tempDirectory.appending(component: "Bar-1.2.3.zip")
10181017
let result = try SwiftPMProduct.SwiftPackage.executeProcess(["archive-source", "--output", destination.pathString], packagePath: packageRoot)
10191018
XCTAssertEqual(result.exitStatus, .terminated(code: 0))
10201019

0 commit comments

Comments
 (0)