Skip to content

Commit b232de4

Browse files
committed
⚰️🧪Remove DisableParallelizationCollectionFixture for some tests
Only tests that manipulate the global, static `UnitsNetSetup.Default.UnitAbbreviations` need to disable parallelization, changes to CurrentCulture is thread-static and is not flaky as long as each test reverts their changes with `CultureScope` or try-finally. # Conflicts: # UnitsNet.Tests/UnitAbbreviationsCacheTests.cs
1 parent 39ebd21 commit b232de4

File tree

5 files changed

+1
-7
lines changed

5 files changed

+1
-7
lines changed

UnitsNet.Tests/CustomCode/LengthTests.cs

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

99
namespace UnitsNet.Tests
1010
{
11-
// Avoid accessing static prop DefaultToString in parallel from multiple tests:
12-
// UnitSystemTests.DefaultToStringFormatting()
13-
// LengthTests.ToStringReturnsCorrectNumberAndUnitWithCentimeterAsDefualtUnit()
14-
[Collection(nameof(DisableParallelizationCollectionFixture))]
1511
public class LengthTests : LengthTestsBase
1612
{
1713
protected override bool SupportsSIUnitSystem => true;

UnitsNet.Tests/CustomCode/ParseTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ namespace UnitsNet.Tests
1515
/// reasonable to assume that testing one unit class would cover
1616
/// all of them. Obviously, that can change in the future.
1717
/// </remarks>
18-
[Collection(nameof(DisableParallelizationCollectionFixture))]
1918
public class ParseTests
2019
{
2120
[Theory]

UnitsNet.Tests/QuantityTests.ToString.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
namespace UnitsNet.Tests
1111
{
12-
[Collection(nameof(DisableParallelizationCollectionFixture))]
1312
public partial class QuantityTests
1413
{
1514
public class ToStringTests

UnitsNet.Tests/UnitAbbreviationsCacheTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace UnitsNet.Tests
1111
{
12+
// Disable parallelization due to manipulating global state, like UnitAbbreviationsCache.Default.MapUnitToDefaultAbbreviation().
1213
[Collection(nameof(DisableParallelizationCollectionFixture))]
1314
public class UnitAbbreviationsCacheTests
1415
{

UnitsNet.Tests/UnitParserTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
namespace UnitsNet.Tests
1111
{
12-
[Collection(nameof(DisableParallelizationCollectionFixture))]
1312
public class UnitParserTests
1413
{
1514
[Theory]

0 commit comments

Comments
 (0)