Skip to content

Commit 1d8d79f

Browse files
committed
CI: replace individual test exclusions with TestCategory-based filtering
Replace the 18-line list of individual Name!= and FullyQualifiedName!~ exclusions in the CI workflow with two TestCategory filters: - TestCategory!=OpenBugs (global, all platforms) - TestCategory!=WindowsOnly (Linux/macOS only) This means adding new bug reproduction tests or platform-specific tests only requires adding [TestCategory("OpenBugs")] or [TestCategory("WindowsOnly")] to the test class or method — no CI workflow changes needed. Classes tagged [TestCategory("OpenBugs")]: - OpenBugs (38 tests) - OpenBugsBitmap (11 tests, also WindowsOnly) - NpAnyTest (np.any with axis is buggy) - np_all_axis_Test (np.all with axis is buggy) - Issue448 Individual methods tagged [TestCategory("OpenBugs")] in NDArray.Indexing.Test.cs: MaskSetter, Compare, Masking_2D_over_3D, Combining_IndexArrays_with_Slices, Combining_MaskArrays_with_Slices, IndexNDArray_Get_Case7, IndexNDArray_Get_Case7_Broadcasted, IndexNDArray_Get_Case8_Broadcasted, IndexNDArray_Set_Case2/3/4, IndexNDArray_Set_Case8_Broadcasted, IndexNDArray_sliced3dreshaped_indexed_by_1d_1d Classes tagged [TestCategory("WindowsOnly")]: - BitmapWithAlphaTests - BitmapExtensionsTests - OpenBugsBitmap Removed [ClassInitialize] RequireWindows guards from Bitmap test classes since the category filter handles platform exclusion at the CI level. Verified: 0 failures with both filter combinations: TestCategory!=OpenBugs → 1636 passed TestCategory!=OpenBugs & TestCategory!=WindowsOnly → 1572 passed
1 parent 9d6e233 commit 1d8d79f

File tree

9 files changed

+28
-43
lines changed

9 files changed

+28
-43
lines changed

.github/workflows/build-and-release.yml

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,11 @@ env:
1818
# NU5048: PackageIconUrl deprecated — cosmetic NuGet warning
1919
DOTNET_NOWARN: CS1570%3BCS1571%3BCS1572%3BCS1573%3BCS1574%3BCS1587%3BCS1591%3BCS1711%3BCS1734%3BCS8981%3BNU5048
2020

21-
# Exclude known-failing test classes and specific test methods from CI.
22-
# These are pre-existing bugs tracked in OpenBugs.cs and related test files.
23-
# When a bug is fixed, remove its exclusion here so CI catches regressions.
24-
TEST_FILTER: >-
25-
FullyQualifiedName!~OpenBugs
26-
& FullyQualifiedName!~NpAnyTest
27-
& FullyQualifiedName!~np_all_axis_Test
28-
& FullyQualifiedName!~Issue448
29-
& Name!=Combining_IndexArrays_with_Slices
30-
& Name!=Combining_MaskArrays_with_Slices
31-
& Name!=IndexNDArray_Get_Case7
32-
& Name!=IndexNDArray_Get_Case7_Broadcasted
33-
& Name!=IndexNDArray_Get_Case8_Broadcasted
34-
& Name!=IndexNDArray_Set_Case2
35-
& Name!=IndexNDArray_Set_Case3
36-
& Name!=IndexNDArray_Set_Case4
37-
& Name!=IndexNDArray_Set_Case8_Broadcasted
38-
& Name!=IndexNDArray_sliced3dreshaped_indexed_by_1d_1d
39-
& Name!=Masking_2D_over_3D
40-
& Name!=MaskSetter
41-
& Name!=Compare
21+
# Exclude tests by category. Tag tests with [TestCategory("...")] instead of
22+
# adding individual Name!= exclusions here.
23+
# OpenBugs — known-failing bug reproductions (pass when fixed, then remove category)
24+
# WindowsOnly — require GDI+/System.Drawing.Common (excluded on Linux/macOS)
25+
TEST_FILTER: TestCategory!=OpenBugs
4226

4327
jobs:
4428
test:
@@ -49,9 +33,9 @@ jobs:
4933
- os: windows-latest
5034
extra_filter: ''
5135
- os: ubuntu-latest
52-
extra_filter: '& FullyQualifiedName!~Bitmap'
36+
extra_filter: '& TestCategory!=WindowsOnly'
5337
- os: macos-latest
54-
extra_filter: '& FullyQualifiedName!~Bitmap'
38+
extra_filter: '& TestCategory!=WindowsOnly'
5539

5640
runs-on: ${{ matrix.os }}
5741

test/NumSharp.UnitTest/Issues/448.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
namespace NumSharp.UnitTest.Issues
88
{
99
[TestClass]
10+
[TestCategory("OpenBugs")]
1011
public class Issue448
1112
{
1213
[TestMethod]

test/NumSharp.UnitTest/Logic/np.any.Test.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace NumSharp.UnitTest.Logic
77
{
88
[TestClass]
9+
[TestCategory("OpenBugs")]
910
public class NpAnyTest
1011
{
1112
[TestMethod]

test/NumSharp.UnitTest/Logic/np_all_axis_Test.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace NumSharp.UnitTest.Logic
99
{
1010
[TestClass]
11+
[TestCategory("OpenBugs")]
1112
public class np_all_axis_Test
1213
{
1314
[TestMethod]

test/NumSharp.UnitTest/NumSharp.Bitmap/BitmapExtensionsTests.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,9 @@
88
namespace NumSharp.UnitTest
99
{
1010
[TestClass]
11+
[TestCategory("WindowsOnly")]
1112
public class BitmapExtensionsTests : TestClass
1213
{
13-
[ClassInitialize]
14-
public static void RequireWindows(TestContext _)
15-
{
16-
if (!OperatingSystem.IsWindows())
17-
Assert.Inconclusive("System.Drawing.Common requires Windows (GDI+).");
18-
}
19-
2014
// ================================================================
2115
// Bugs discovered during test coverage expansion:
2216
//

test/NumSharp.UnitTest/NumSharp.Bitmap/BitmapWithAlphaTests.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,9 @@
88
namespace NumSharp.UnitTest
99
{
1010
[TestClass]
11+
[TestCategory("WindowsOnly")]
1112
public class BitmapWithAlphaTests : TestClass
1213
{
13-
[ClassInitialize]
14-
public static void RequireWindows(TestContext _)
15-
{
16-
if (!OperatingSystem.IsWindows())
17-
Assert.Inconclusive("System.Drawing.Common requires Windows (GDI+).");
18-
}
19-
2014
[TestMethod]
2115
public void ToNDArray_Case1()
2216
{

test/NumSharp.UnitTest/OpenBugs.Bitmap.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,10 @@ namespace NumSharp.UnitTest
5555
/// Total: 8 distinct bugs, 10 test methods.
5656
/// </summary>
5757
[TestClass]
58+
[TestCategory("OpenBugs")]
59+
[TestCategory("WindowsOnly")]
5860
public class OpenBugsBitmap : TestClass
5961
{
60-
[ClassInitialize]
61-
public static void RequireWindows(TestContext _)
62-
{
63-
if (!OperatingSystem.IsWindows())
64-
Assert.Inconclusive("System.Drawing.Common requires Windows (GDI+).");
65-
}
6662

6763
// ================================================================
6864
//

test/NumSharp.UnitTest/OpenBugs.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ namespace NumSharp.UnitTest
5858
/// Total: 17 distinct bugs, 38 test methods.
5959
/// </summary>
6060
[TestClass]
61+
[TestCategory("OpenBugs")]
6162
public partial class OpenBugs : TestClass
6263
{
6364
// ================================================================

test/NumSharp.UnitTest/Selection/NDArray.Indexing.Test.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public void IndexAccessorSetter()
6363
}
6464

6565
[TestMethod]
66+
[TestCategory("OpenBugs")]
6667
public void MaskSetter()
6768
{
6869
NDArray nd = new double[] { 1, 2, 3 };
@@ -75,6 +76,7 @@ public void MaskSetter()
7576
}
7677

7778
[TestMethod]
79+
[TestCategory("OpenBugs")]
7880
public void Compare()
7981
{
8082
throw new Exception("This test kills test engine process due to Debug.Assert");
@@ -1106,6 +1108,7 @@ public void Masking_1D_over_2D()
11061108
}
11071109

11081110
[TestMethod]
1111+
[TestCategory("OpenBugs")]
11091112
public void Masking_2D_over_3D()
11101113
{
11111114
//>>> x = np.arange(30).reshape(2,3,5)
@@ -1139,6 +1142,7 @@ public void MixedIndexing_NDim()
11391142
}
11401143

11411144
[TestMethod]
1145+
[TestCategory("OpenBugs")]
11421146
public void Combining_IndexArrays_with_Slices()
11431147
{
11441148
//>>> y = np.arange(35).reshape(5, 7)
@@ -1152,6 +1156,7 @@ public void Combining_IndexArrays_with_Slices()
11521156

11531157

11541158
[TestMethod]
1159+
[TestCategory("OpenBugs")]
11551160
public void Combining_MaskArrays_with_Slices()
11561161
{
11571162
//>>> y = np.arange(35).reshape(5, 7)
@@ -1252,6 +1257,7 @@ void Test(NDArray nd)
12521257
}
12531258

12541259
[TestMethod]
1260+
[TestCategory("OpenBugs")]
12551261
public void IndexNDArray_sliced3dreshaped_indexed_by_1d_1d()
12561262
{
12571263
Test(np.arange(2 * 2 * 4 * 2)["::2"].reshape(2, 4, 2));
@@ -1334,6 +1340,7 @@ public void IndexNDArray_Set_Case1()
13341340
}
13351341

13361342
[TestMethod]
1343+
[TestCategory("OpenBugs")]
13371344
public void IndexNDArray_Set_Case2()
13381345
{
13391346
var a = np.arange(8).reshape(2, 4);
@@ -1342,6 +1349,7 @@ public void IndexNDArray_Set_Case2()
13421349
}
13431350

13441351
[TestMethod]
1352+
[TestCategory("OpenBugs")]
13451353
public void IndexNDArray_Set_Case3()
13461354
{
13471355
var a = np.arange(8).reshape(2, 4);
@@ -1350,6 +1358,7 @@ public void IndexNDArray_Set_Case3()
13501358
}
13511359

13521360
[TestMethod]
1361+
[TestCategory("OpenBugs")]
13531362
public void IndexNDArray_Set_Case4()
13541363
{
13551364
var a = np.arange(8).reshape(2, 4);
@@ -1382,6 +1391,7 @@ public void IndexNDArray_Set_Case7_Boolean()
13821391
}
13831392

13841393
[TestMethod]
1394+
[TestCategory("OpenBugs")]
13851395
public void IndexNDArray_Set_Case8_Broadcasted()
13861396
{
13871397
var a = np.broadcast_to(np.arange(4).reshape(1, 4), (2, 4));
@@ -1439,6 +1449,7 @@ public void IndexNDArray_Get_Case6_Broadcasted()
14391449
}
14401450

14411451
[TestMethod]
1452+
[TestCategory("OpenBugs")]
14421453
public void IndexNDArray_Get_Case7_Broadcasted()
14431454
{
14441455
//TODO: this produces incorrect return shape
@@ -1452,6 +1463,7 @@ public void IndexNDArray_Get_Case7_Broadcasted()
14521463
}
14531464

14541465
[TestMethod]
1466+
[TestCategory("OpenBugs")]
14551467
public void IndexNDArray_Get_Case7()
14561468
{
14571469
//TODO: this produces incorrect return shape
@@ -1468,6 +1480,7 @@ public void IndexNDArray_Get_Case7()
14681480

14691481

14701482
[TestMethod]
1483+
[TestCategory("OpenBugs")]
14711484
public void IndexNDArray_Get_Case8_Broadcasted()
14721485
{
14731486
//TODO: this produces incorrect return shape

0 commit comments

Comments
 (0)