Files
ViewDesignEngine/python/test_native_wheels.ps1
T

33 lines
1.9 KiB
PowerShell

# Install and import-test the native cp311/cp314 wheels.
# Usage: powershell -ExecutionPolicy Bypass -File python/test_native_wheels.ps1
param(
[string]$WheelDir = "build/_dwgreview/native_wheels",
[string]$Python311 = "C:\Program Files\Python311\python.exe",
[string]$Python314 = "C:\Python314\python.exe"
)
$ErrorActionPreference = "Stop"
$root = (Resolve-Path ".").Path
$wheelDirAbs = (Resolve-Path $WheelDir).Path
$tests = @(
@{ Python = $Python311; Tag = "cp311-cp311-win_amd64" },
@{ Python = $Python314; Tag = "cp314-cp314-win_amd64" }
)
foreach ($test in $tests) {
$wheel = Join-Path $wheelDirAbs ("vde-1.0.87-" + $test.Tag + ".whl")
if (-not (Test-Path $wheel)) { throw "wheel not found: $wheel" }
$target = Join-Path $root ("build/_dwgreview/pyinstall_" + $test.Tag)
Remove-Item -Recurse -Force $target -ErrorAction SilentlyContinue
& $test.Python -m pip install --no-deps --target $target $wheel | Out-Null
if ($LASTEXITCODE -ne 0) { throw "pip failed: $wheel" }
$env:PYTHONPATH = $target
Push-Location (Join-Path $root "build/_dwgreview")
try {
& $test.Python -c "import vde; a=vde.assembly.Assembly('a'); assert vde.native; assert vde.native_assembly; assert a.add_subassembly('h'); assert a.add_part_to('h', 'p', vde.brep.make_box(2,3,4)); assert a.tree()['children'][0]['children'][0]['name'] == 'p'; assert a.tree()['children'][0]['children'][0]['part_index'] == 0; assert a.remove('p'); assert len(a.tree()['children'][0]['children']) == 0; assert a.find('h')['name'] == 'h'; assert a.find('missing') is None; a.clear(); assert a.part_count() == 0; assert len(a.tree()['children']) == 0; print('WHEEL PASS', vde.__version__)"
if ($LASTEXITCODE -ne 0) { throw "import failed: $wheel" }
} finally {
Pop-Location
Remove-Item Env:\PYTHONPATH -ErrorAction SilentlyContinue
}
}
Write-Host "native wheel tests PASS"