From e0fdf1ed0094bcaec90791be94f80b16fce52ba1 Mon Sep 17 00:00:00 2001 From: John Kordich Date: Wed, 3 Aug 2016 14:32:12 -0700 Subject: [PATCH] Fixing up mof compilation test script to set PSMODULEPATH properly --- .../MOF-Compilation.Tests.ps1 | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/test/powershell/Modules/PSDesiredStateConfiguration/MOF-Compilation.Tests.ps1 b/test/powershell/Modules/PSDesiredStateConfiguration/MOF-Compilation.Tests.ps1 index fd5722d29e..98974f9c17 100644 --- a/test/powershell/Modules/PSDesiredStateConfiguration/MOF-Compilation.Tests.ps1 +++ b/test/powershell/Modules/PSDesiredStateConfiguration/MOF-Compilation.Tests.ps1 @@ -1,13 +1,15 @@ -$originalPSModulePath = $env:PSModulePath - -try -{ - $env:DSC_HOME = Join-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath assets) -ChildPath dsc -# $env:PSMODULEPATH = $env:PSMODULEPATH + ";" + $env:DEVPATH + "Modules" -# $env:PSModulePath = "$($env:DEVPATH)\Modules" - Describe "DSC MOF Compilation" -tags "CI" { + AfterAll { + $env:PSMODULEPATH = $_modulePath + } + BeforeAll { + $env:DSC_HOME = Join-Path -Path (Join-Path -Path $PSScriptRoot -ChildPath assets) -ChildPath dsc + $_modulePath = $env:PSMODULEPATH + $powershellexe = (get-process -pid $PID).MainModule.FileName + $env:PSMODULEPATH = join-path ([io.path]::GetDirectoryName($powershellexe)) Modules + } + It "Should be able to compile a MOF from a basic configuration" -Skip:$IsWindows { [Scriptblock]::Create(@" configuration DSCTestConfig @@ -162,8 +164,3 @@ Describe "DSC MOF Compilation" -tags "CI" { } } -} -finally -{ - $env:PSModulePath = $originalPSModulePath -} \ No newline at end of file