From fb7c7b038b720fc78d92662ac3405029b8db625c Mon Sep 17 00:00:00 2001 From: "James Truher [MSFT]" Date: Tue, 19 Sep 2017 13:51:21 -0700 Subject: [PATCH] Only run tests on Windows, otherwise skip them. (#4861) --- .../CimCmdletsResources.Tests.ps1 | 5 ++++- .../WSManResources.Tests.ps1 | 18 +++++------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/test/powershell/engine/ResourceValidation/CimCmdletsResources.Tests.ps1 b/test/powershell/engine/ResourceValidation/CimCmdletsResources.Tests.ps1 index 4715c61330..63ca24aba4 100644 --- a/test/powershell/engine/ResourceValidation/CimCmdletsResources.Tests.ps1 +++ b/test/powershell/engine/ResourceValidation/CimCmdletsResources.Tests.ps1 @@ -6,7 +6,10 @@ $assemblyName = "Microsoft.Management.Infrastructure.CimCmdlets" # entries in the csproj for the assembly $excludeList = @() # load the module since it isn't there by default -import-module CimCmdlets +if ( $IsWindows ) +{ + import-module CimCmdlets +} # run the tests Test-ResourceStrings -AssemblyName $AssemblyName -ExcludeList $excludeList diff --git a/test/powershell/engine/ResourceValidation/WSManResources.Tests.ps1 b/test/powershell/engine/ResourceValidation/WSManResources.Tests.ps1 index 2e3362d99a..0d88463a84 100644 --- a/test/powershell/engine/ResourceValidation/WSManResources.Tests.ps1 +++ b/test/powershell/engine/ResourceValidation/WSManResources.Tests.ps1 @@ -6,17 +6,9 @@ $assemblyName = "Microsoft.WSMan.Management" # entries in the csproj for the assembly $excludeList = @() # load the module since it isn't there by default -import-module Microsoft.WSMan.Management - - -try { - if ( ! $IsWindows ) - { - $PSDefaultParameterValues["it:skip"] = $true - } - # run the tests - Test-ResourceStrings -AssemblyName $AssemblyName -ExcludeList $excludeList -} -finally { - $PSDefaultParameterValues.Remove("it:skip") +if ( $IsWindows ) { + import-module Microsoft.WSMan.Management } + +# run the tests +Test-ResourceStrings -AssemblyName $AssemblyName -ExcludeList $excludeList