-
Notifications
You must be signed in to change notification settings - Fork 229
Add flaky test attribute #8811
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
Add flaky test attribute #8811
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,8 @@ variables: | |
| value: $(Build.SourcesDirectory)\artifacts\log\$(_configuration) | ||
| - name: __VSNeverShowWhatsNew | ||
| value: 1 | ||
| - name: RAZOR_RUN_FLAKY_TESTS | ||
| value: 'true' | ||
|
||
|
|
||
| stages: | ||
| - template: \stages\visual-studio\agent.yml@DartLabTemplates | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| // Copyright (c) .NET Foundation. All rights reserved. | ||
| // Licensed under the MIT license. See License.txt in the project root for license information. | ||
|
|
||
| using System; | ||
| using Xunit; | ||
|
|
||
| namespace Microsoft.VisualStudio.Razor.IntegrationTests; | ||
|
|
||
| [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] | ||
| public class FlakyFactAttribute : IdeFactAttribute | ||
ryzngard marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| private readonly Lazy<bool> _runFlakyTests = new(() => Environment.GetEnvironmentVariable("RAZOR_RUN_FLAKY_TESTS")?.ToLower() == "true"); | ||
|
|
||
| public FlakyFactAttribute() | ||
| { | ||
| } | ||
|
|
||
| private string _issue = ""; | ||
| public string Issue | ||
| { | ||
| get => _issue; | ||
| set | ||
| { | ||
| _issue = value; | ||
|
|
||
| if (!_runFlakyTests.Value) | ||
| { | ||
| #pragma warning disable CS0618 | ||
| Skip = _issue; | ||
| #pragma warning restore CS0618 | ||
| } | ||
| } | ||
| } | ||
|
|
||
| [Obsolete("Use Issue instead of Skip")] | ||
| public new string Skip | ||
| { | ||
| get => base.Skip; | ||
| set => base.Skip = value; | ||
| } | ||
| } | ||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol, finally!