mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
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:
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
|
||||
|
||||
#
|
||||
|
||||
Reference in new issue
Block a user