Skip to content

Commit 133a2c6

Browse files
author
Mikhail Koliada
committed
Migrate build pipeline to Pester v5
1 parent a5914bf commit 133a2c6

File tree

2 files changed

+24
-25
lines changed

2 files changed

+24
-25
lines changed

.github/workflows/python-builder.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,13 @@ jobs:
146146
147147
- name: Run tests
148148
run: |
149-
Install-Module Pester -Force -Scope CurrentUser -RequiredVersion 4.10.1
149+
Install-Module Pester -Force -Scope CurrentUser -RequiredVersion 5.3.1
150150
Import-Module Pester
151-
$pesterParams = @{
152-
Path="./python-tests.ps1";
153-
Parameters=@{
151+
$pesterContainer = New-PesterContainer -Path './python-tests.ps1' -Data @{
154152
Version="${{ env.VERSION }}";
155153
Platform="${{ matrix.platform }}";
156-
}
157154
}
158-
$Result = Invoke-Pester -PassThru -Script $pesterParams
155+
Invoke-Pester -Container $pesterContainer -PassThru
159156
if ($Result.FailedCount -gt 0) {
160157
$host.SetShouldExit($Result.FailedCount)
161158
exit $Result.FailedCount

tests/python-tests.ps1

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,31 @@ Import-Module (Join-Path $PSScriptRoot "../helpers/pester-extensions.psm1")
99
Import-Module (Join-Path $PSScriptRoot "../helpers/common-helpers.psm1")
1010
Import-Module (Join-Path $PSScriptRoot "../builders/python-version.psm1")
1111

12-
function Analyze-MissingModules([string] $buildOutputLocation) {
13-
$searchStringStart = "Failed to build these modules:"
14-
$searchStringEnd = "running build_scripts"
15-
$pattern = "$searchStringStart(.*?)$searchStringEnd"
12+
BeforeAll {
13+
function Analyze-MissingModules([string] $buildOutputLocation) {
14+
$searchStringStart = "Failed to build these modules:"
15+
$searchStringEnd = "running build_scripts"
16+
$pattern = "$searchStringStart(.*?)$searchStringEnd"
1617

17-
$buildContent = Get-Content -Path $buildOutputLocation
18-
$splitBuiltOutput = $buildContent -split "\n";
18+
$buildContent = Get-Content -Path $buildOutputLocation
19+
$splitBuiltOutput = $buildContent -split "\n";
1920

20-
### Search for missing modules that are displayed between the search strings
21-
$regexMatch = [regex]::match($SplitBuiltOutput, $Pattern)
22-
if ($regexMatch.Success)
23-
{
24-
$module = $regexMatch.Groups[1].Value.Trim()
25-
Write-Host "Failed missing modules:"
26-
Write-Host $module
27-
if ( ($module -eq "_tkinter") -and ( [semver]"$($Version.Major).$($Version.Minor)" -ge [semver]"3.10" -and $Version.PreReleaseLabel ) ) {
28-
Write-Host "$module $Version ignored"
29-
} else {
30-
return 1
21+
### Search for missing modules that are displayed between the search strings
22+
$regexMatch = [regex]::match($SplitBuiltOutput, $Pattern)
23+
if ($regexMatch.Success)
24+
{
25+
$module = $regexMatch.Groups[1].Value.Trim()
26+
Write-Host "Failed missing modules:"
27+
Write-Host $module
28+
if ( ($module -eq "_tkinter") -and ( [semver]"$($Version.Major).$($Version.Minor)" -ge [semver]"3.10" -and $Version.PreReleaseLabel ) ) {
29+
Write-Host "$module $Version ignored"
30+
} else {
31+
return 1
32+
}
3133
}
32-
}
3334

34-
return 0
35+
return 0
36+
}
3537
}
3638

3739
Describe "Tests" {

0 commit comments

Comments
 (0)