Skip to content

Commit

Permalink
(GH-1020) WindowsOnly tests by platform, not ignore
Browse files Browse the repository at this point in the history
Previously, Windows only tests were ignored based on a build compilation
symbol `__MonoCS__`. This allowed skipping (ignoring) those tests
easily. However newer versions of Mono simply don't use that symbol
anymore and the testing aspect does not ignore those tests, ultimately
causing them to fail when run in a non-Windows environment.

Switch over to using platform that only includes Windows. This will
exclude Windows only tests from running on Unix, Linux and MacOS.
  • Loading branch information
TheCakeIsNaOH authored and ferventcoder committed Mar 23, 2020
1 parent 43822e3 commit d45658c
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/chocolatey.tests/TinySpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,13 @@ public PendingAttribute(string reason)
}
}

#if __MonoCS__
public class WindowsOnlyAttribute : IgnoreAttribute
public class WindowsOnlyAttribute : PlatformAttribute
{
public WindowsOnlyAttribute() : base("This is a Windows only test")
public WindowsOnlyAttribute()
{
Exclude = "Unix,Linux,MacOsX";
}
}
#else
public class WindowsOnlyAttribute : Attribute
{
}
#endif

public class IntegrationAttribute : CategoryAttribute
{
Expand Down

0 comments on commit d45658c

Please sign in to comment.