From 22fe302116a54136ec167a2300c941999743967a Mon Sep 17 00:00:00 2001 From: Rob Reynolds Date: Wed, 25 Mar 2020 09:17:55 -0500 Subject: [PATCH] (GH-1020) Direct platform only for windows tests Unfortunately, it appears like platform exclusions go by the actual name of "Platform" and attempting to inherit the attribute is ignored by NUnit when selecting platforms to exclude for testing. Add those directly for now until a better alternative is available. --- src/chocolatey.tests/TinySpec.cs | 4 +++- .../infrastructure.app/services/RegistryServiceSpecs.cs | 4 ++++ .../infrastructure.app/services/TemplateServiceSpecs.cs | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/chocolatey.tests/TinySpec.cs b/src/chocolatey.tests/TinySpec.cs index 66651afefb..9ccff1d130 100644 --- a/src/chocolatey.tests/TinySpec.cs +++ b/src/chocolatey.tests/TinySpec.cs @@ -151,8 +151,10 @@ public class WindowsOnlyAttribute : PlatformAttribute { public WindowsOnlyAttribute() { - Exclude = "Unix,Linux,MacOsX"; + Exclude = "Mono, Linux, MacOsX, Linux"; } + + public WindowsOnlyAttribute(string platforms): base(platforms) } public class IntegrationAttribute : CategoryAttribute diff --git a/src/chocolatey.tests/infrastructure.app/services/RegistryServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/RegistryServiceSpecs.cs index cf2d03e470..f2102d1dce 100644 --- a/src/chocolatey.tests/infrastructure.app/services/RegistryServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/RegistryServiceSpecs.cs @@ -21,6 +21,7 @@ namespace chocolatey.tests.infrastructure.app.services using chocolatey.infrastructure.services; using Microsoft.Win32; using Moq; + using NUnit.Framework; using Should; using Registry = chocolatey.infrastructure.app.domain.Registry; @@ -47,6 +48,7 @@ protected void reset() } [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_RegistryService_get_installer_keys_is_called : RegistryServiceSpecsBase { private Registry _result; @@ -69,6 +71,7 @@ public void should_not_be_null() } [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_RegistryService_get_key_is_called_for_a_value_that_exists : RegistryServiceSpecsBase { private RegistryKey _result; @@ -111,6 +114,7 @@ public void should_contain_values() } [WindowsOnly] + [Platform(Exclude = "Mono")] public class when_RegistryService_get_key_is_called_for_a_value_that_does_not_exist : RegistryServiceSpecsBase { private RegistryKey _result; diff --git a/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs b/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs index 364dd1bf10..fb9f9f9659 100644 --- a/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs +++ b/src/chocolatey.tests/infrastructure.app/services/TemplateServiceSpecs.cs @@ -26,6 +26,7 @@ namespace chocolatey.tests.infrastructure.app.services using chocolatey.infrastructure.app.templates; using chocolatey.infrastructure.filesystem; using Moq; + using NUnit.Framework; using Should; public class TemplateServiceSpecs @@ -373,6 +374,7 @@ public override void BeforeEachSpec() [Fact] [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_generate_all_files_and_directories() { because(); @@ -394,6 +396,7 @@ public void should_generate_all_files_and_directories() [Fact] [WindowsOnly] + [Platform(Exclude = "Mono")] public void should_generate_all_files_and_directories_even_with_outputdirectory() { config.OutputDirectory = "c:\\packages";