Skip to content

Commit 190ac01

Browse files
natemcmasterclaude
andauthored
fix: prevent flaky tests by disabling parallel execution for registry tests (#584)
Tests using CommandMetadataRegistry share static state and were failing intermittently when run in parallel. Added [Collection("MetadataRegistry")] attribute to all test classes that interact with the registry to ensure they run sequentially. Affected test classes: - CommandMetadataRegistryTests - ConventionAotPathTests - MetadataProviderTests - RemainingArgsPropertyConventionTests Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent aaac585 commit 190ac01

4 files changed

Lines changed: 8 additions & 0 deletions

File tree

test/CommandLineUtils.Tests/RemainingArgsPropertyConventionTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
namespace McMaster.Extensions.CommandLineUtils.Tests
1212
{
13+
// Uses shared static CommandMetadataRegistry - must not run in parallel with other registry tests
14+
[Collection("MetadataRegistry")]
1315
public class RemainingArgsPropertyConventionTests : ConventionTestBase
1416
{
1517
public RemainingArgsPropertyConventionTests(ITestOutputHelper output) : base(output)

test/CommandLineUtils.Tests/SourceGeneration/CommandMetadataRegistryTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
namespace McMaster.Extensions.CommandLineUtils.Tests.SourceGeneration
1010
{
11+
// Uses shared static CommandMetadataRegistry - must not run in parallel with other registry tests
12+
[Collection("MetadataRegistry")]
1113
public class CommandMetadataRegistryTests
1214
{
1315
[Command(Name = "test1")]

test/CommandLineUtils.Tests/SourceGeneration/ConventionAotPathTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ namespace McMaster.Extensions.CommandLineUtils.Tests.SourceGeneration
1414
/// Tests for the AOT-friendly code paths in conventions.
1515
/// These tests exercise the generated metadata paths in conventions.
1616
/// </summary>
17+
// Uses shared static CommandMetadataRegistry - must not run in parallel with other registry tests
18+
[Collection("MetadataRegistry")]
1719
public class ConventionAotPathTests : IDisposable
1820
{
1921
public ConventionAotPathTests()

test/CommandLineUtils.Tests/SourceGeneration/MetadataProviderTests.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
namespace McMaster.Extensions.CommandLineUtils.Tests.SourceGeneration
1010
{
11+
// Uses shared static CommandMetadataRegistry - must not run in parallel with other registry tests
12+
[Collection("MetadataRegistry")]
1113
public class MetadataProviderTests
1214
{
1315
[Command(Name = "test", Description = "A test command")]

0 commit comments

Comments
 (0)