Browse Source

Fix xunit.v3 test failures post-migration

pull/2854/head
Stefan Nikolei 2 months ago
parent
commit
34f44a6994
  1. 6
      tests/ImageSharp.Tests.ProfilingSandbox/Program.cs
  2. 2
      tests/ImageSharp.Tests/Image/ImageTests.Decode_Cancellation.cs
  3. 2
      tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs
  4. 2
      tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.cs
  5. 2
      tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs
  6. 11
      tests/ImageSharp.Tests/TestUtilities/Attributes/ImageDataAttributeBase.cs
  7. 2
      tests/ImageSharp.Tests/TestUtilities/SixLaborsXunitTestFramework.cs
  8. 2
      tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs

6
tests/ImageSharp.Tests.ProfilingSandbox/Program.cs

@ -4,6 +4,7 @@
using SixLabors.ImageSharp.Tests.PixelFormats.PixelOperations;
using SixLabors.ImageSharp.Tests.ProfilingBenchmarks;
using SixLabors.ImageSharp.Tests.ProfilingSandbox;
using Xunit;
// in this file, comments are used for disabling stuff for local execution
#pragma warning disable SA1515
@ -31,7 +32,12 @@ static void RunToVector4ProfilingTest()
sealed class ConsoleOutput : ITestOutputHelper
{
public void Write(string message) => Console.Write(message);
public void Write(string format, params object[] args) => Console.Write(format, args);
public void WriteLine(string message) => Console.WriteLine(message);
public void WriteLine(string format, params object[] args) => Console.WriteLine(format, args);
public string Output { get; }
}

2
tests/ImageSharp.Tests/Image/ImageTests.Decode_Cancellation.cs

@ -58,7 +58,7 @@ public partial class ImageTests
public static TheoryData<bool, string, double> LoadData { get; } = CreateLoadData();
// TODO: Figure out cancellation failures on Linux
[Theory(SkipType = typeof(TestEnvironment), SkipUnless = nameof(TestEnvironment.IsWindows))]
[Theory(Skip = "Skipped on non-Windows platforms", SkipType = typeof(TestEnvironment), SkipUnless = nameof(TestEnvironment.IsWindows))]
[MemberData(nameof(LoadData))]
public async Task LoadAsync_IsCancellable(bool useMemoryStream, string file, double percentageOfStreamReadToCancel)
{

2
tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.Trim.cs

@ -57,7 +57,7 @@ public partial class UniformUnmanagedMemoryPoolTests
// TODO: Investigate failures on macOS. All handles are released after GC.
// (It seems to happen more consistently on .NET 6.)
[Fact(SkipUnless = nameof(IsNotMacOS))]
[Fact(Skip = "Skipped on macOS", SkipUnless = nameof(IsNotMacOS))]
public void MultiplePoolInstances_TrimPeriodElapsed_AllAreTrimmed()
{
if (!TestEnvironment.RunsOnCI)

2
tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedMemoryPoolTests.cs

@ -240,7 +240,7 @@ public partial class UniformUnmanagedMemoryPoolTests
public static readonly bool IsNotMacOS = !TestEnvironment.IsMacOS;
// TODO: Investigate macOS failures
[Theory(SkipUnless = nameof(IsNotMacOS))]
[Theory(Skip = "Skipped on macOS", SkipUnless = nameof(IsNotMacOS))]
[InlineData(false)]
[InlineData(true)]
public void RentReturnRelease_SubsequentRentReturnsDifferentHandles(bool multiple)

2
tests/ImageSharp.Tests/Memory/Allocators/UniformUnmanagedPoolMemoryAllocatorTests.cs

@ -584,7 +584,7 @@ public class UniformUnmanagedPoolMemoryAllocatorTests
}
}
[Fact(SkipType = typeof(Environment), SkipUnless = nameof(Environment.Is64BitProcess))]
[Fact(Skip = "Requires 64-bit process", SkipType = typeof(Environment), SkipUnless = nameof(Environment.Is64BitProcess))]
public void MemoryAllocator_Create_SetHighLimit()
{
RemoteExecutor.Invoke(RunTest).Dispose();

11
tests/ImageSharp.Tests/TestUtilities/Attributes/ImageDataAttributeBase.cs

@ -71,11 +71,14 @@ public abstract class ImageDataAttributeBase : DataAttribute
object obj = accessor();
if (obj is IEnumerable<object> memberItems)
{
addedRows = memberItems.Select(x => x as object[]);
if (addedRows.Any(x => x == null))
// In xunit.v3, TheoryData<T...> yields ITheoryDataRow, not object[].
// Call GetData() to unpack the row's values.
addedRows = memberItems.Select(x =>
{
addedRows = memberItems.Select(x => new[] { x });
}
if (x is ITheoryDataRow row) return row.GetData();
if (x is object[] arr) return arr;
return new[] { x };
});
}
}
}

2
tests/ImageSharp.Tests/TestUtilities/SixLaborsXunitTestFramework.cs

@ -13,6 +13,6 @@ public class SixLaborsXunitTestFramework : XunitTestFramework
{
public SixLaborsXunitTestFramework()
{
Console.WriteLine(HostEnvironmentInfo.GetInformation());
Console.Error.WriteLine(HostEnvironmentInfo.GetInformation());
}
}

2
tests/ImageSharp.Tests/TestUtilities/Tests/TestEnvironmentTests.cs

@ -120,7 +120,7 @@ public class TestEnvironmentTests
// https://github.com/SixLabors/ImageSharp/blob/381dff8640b721a34b1227c970fcf6ad6c5e3e72/ci-test.ps1#L30
public static bool IsNot32BitNetFramework = !TestEnvironment.IsFramework || TestEnvironment.Is64BitProcess;
[Fact(SkipUnless = nameof(IsNot32BitNetFramework))]
[Fact(Skip = "Not supported on 32-bit .NET Framework", SkipUnless = nameof(IsNot32BitNetFramework))]
public void RemoteExecutor_FailingRemoteTestShouldFailLocalTest()
{
static void FailingCode()

Loading…
Cancel
Save