Update tests to account for when $PSHOME is readonly (#9279)

Co-Authored-By: SteveL-MSFT <slee@microsoft.com>


Co-authored-by: Travis Plunk <travis.plunk@microsoft.com>
This commit is contained in:
Steve LeeandTravis Plunk authored and Travis Plunk committed 2019-04-04 23:01:01 -07:00
1 parent 4ec36a0d4a
commit b8317de469
16 files changed
+160 -72

No files matched your search

@@ -1,12 +1,16 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
Import-Module HelpersCommon
try
{
# Skip all tests on non-windows and non-PowerShellCore and non-elevated platforms.
$originalDefaultParameterValues = $PSDefaultParameterValues.Clone()
$originalWarningPreference = $WarningPreference
$WarningPreference = "SilentlyContinue"
$IsNotSkipped = ($IsWindows -and $IsCoreCLR -and (Test-IsElevated))
# Skip all tests if can't write to $PSHOME as Register-PSSessionConfiguration writes to $PSHOME
$IsNotSkipped = ($IsWindows -and $IsCoreCLR -and (Test-IsElevated) -and (Test-CanWriteToPsHome))
$PSDefaultParameterValues["it:skip"] = !$IsNotSkipped
#