-
Notifications
You must be signed in to change notification settings - Fork 387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flaky test: UnitsNet.Tests.UnitSystemTests.PositiveInfinityFormatting #436
Comments
I think fix#1 is possible by applying test collection definition I'll try fix#2 also then submit a PR whichever fixes the issue. |
It seems like my system's default I tried just running the We can pursue implementing the two fixes suggested earlier though I'm not sure how we can verify that it does resolve the issue. |
It would be hard to verify. You are also right that on computers with a different culture, this test may always fail since it doesn't try to specify a culture. That test should specify InvariantCulture, which is a third fix on this problem - but it only fixes this particular test. I would do all 3 really, since they all seem like the right thing to do in my mind. Then I also wouldn't care too much to try to verify if it actually fixes it, let's just assume it does until it proves us wrong down the road ;) |
…ormatting (#438) * Fix #436 Flaky test: UnitsNet.Tests.UnitSystemTests.PositiveInfinityFormatting Fixes #436 Added `UnitSystemFixture` class which is a `CollectionDefinition` class used to group test classes: 1. that rely on manipulating CultureInfo. See #436 2. to avoid accessing static prop DefaultToString in parallel from multiple tests: a. UnitSystemTests.DefaultToStringFormatting() b. LengthTests.ToStringReturnsCorrectNumberAndUnitWithCentimeterAsDefualtUnit() Changes in this PR: - `UnitSystemTests.GetDefaultAbbreviationFallsBackToUsEnglishCulture`: Set CultureInfo properties back to their original values. - Specify `InvariantCulture` on the following `UnitSystemTests` tests: 1. `NegativeInfinityFormatting` 2. `PositiveInfinityFormatting` - Applied `[Collection(nameof(UnitSystemFixture)]` attribute to test classes that: - Sets `UnitSystem.DefaultCulture` - Originally uses `[Collection("DefaulToString")]` that also depends on `CultureInfo` - Only one `Collection` attribute per test class. - Updated to `xunit` and `xunit.runner.visualstudio` to v2.3.1 (was v2.3.0-beta4-build3742) - To have the [CollectionDefinition(DisableParallelization = true)] feature. See https://xunit.github.io/releases/2.3-beta5 * Removed `InvariantCulture` Removed `InvariantCulture` on the following `UnitSystemTests` tests: 1. `NegativeInfinityFormatting` 2. `PositiveInfinityFormatting` * Specified InvariantCulture in InfinityFormatting Tests
This only happens very rarely on AppVeyor (first time I can think of), but @gojanpaolo reports it happens all the time on his setup. I assume this is due to manipulating static values in other tests, such as:
https://ci.appveyor.com/project/angularsen/unitsnet/build/724/tests
UnitsNet.Tests.UnitSystemTests.PositiveInfinityFormatting
The following:
So the fix is likely one or both of:
The text was updated successfully, but these errors were encountered: