Skip to content

Commit bec7ff4

Browse files
[tests] ignore failures if 7zip.exe is not found (#1235)
Tests randomly started failing due to: System.Exception : Could not find 7zip.exe in Xamarin installation These fail on PRs, but succeed on CI for main and release branches. Let's ignore the tests for now, as we haven't changed anything to break Xamarin.Build.Download. This required us to update to XUnit 3: * Use xunit v3 for `Assert.Skip()` Context: https://xunit.net/docs/getting-started/v3/whats-new Context: https://xunit.net/docs/getting-started/v3/migration
1 parent 41ff163 commit bec7ff4

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

util/Xamarin.Build.Download/source/Xamarin.Build.Download.Tests/Helpers/TestsBase.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,14 @@ protected static void AssertNoMessagesOrWarnings (MSBuildTestLogger logger, para
6262
return;
6363
}
6464
}
65-
throw new Exception (err.Message);
65+
if (err.Message.Contains ("Could not find 7zip"))
66+
{
67+
Assert.Skip ("Test ignored due to known issue: " + err.Message);
68+
}
69+
else
70+
{
71+
Assert.Fail ("Unexpected error: " + err.Message);
72+
}
6673
}
6774

6875
// work around Mono's ProjectInstance.Build using a separate BuildManager and not shutting it down

util/Xamarin.Build.Download/source/Xamarin.Build.Download.Tests/Xamarin.Build.Download.Tests.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<TargetFramework>$(_DefaultNetTargetFramework)</TargetFramework>
55
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
66
<RollForward>Major</RollForward>
7+
<OutputType>Exe</OutputType>
78
</PropertyGroup>
89

910
<Target Name="Pack"></Target>
@@ -14,8 +15,8 @@
1415
<PackageReference Include="Microsoft.Build.Framework" Version="$(MSBuildPackageReferenceVersion)" />
1516
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
1617
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
17-
<PackageReference Include="xunit" Version="2.4.2" />
18-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
18+
<PackageReference Include="xunit.v3" Version="3.0.0" />
19+
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.3">
1920
<PrivateAssets>all</PrivateAssets>
2021
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
2122
</PackageReference>

0 commit comments

Comments
 (0)