Skip to content

Commit

Permalink
Avoid failing test if cleanup fails
Browse files Browse the repository at this point in the history
Log a message instead
  • Loading branch information
0xced committed Apr 11, 2024
1 parent e55dde6 commit 4d70b45
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/Chisel.Tests/Support/TestApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@ async Task IAsyncLifetime.InitializeAsync()

Task IAsyncLifetime.DisposeAsync()
{
_workingDirectory.Delete(recursive: true);
try
{
_workingDirectory.Delete(recursive: true);
}
catch (UnauthorizedAccessException exception)
{
// This sometimes happen on the Windows runner in GitHub actions
// > [Test Class Cleanup Failure (Chisel.Tests.ChiseledAppTests)]: System.UnauthorizedAccessException : Access to the path 'TestApp.dll' is denied.
_messageSink.OnMessage(new DiagnosticMessage($"Deleting {_workingDirectory} failed: {exception}"));
}
return Task.CompletedTask;
}

Expand Down

0 comments on commit 4d70b45

Please sign in to comment.