-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_tests.ps1
More file actions
96 lines (81 loc) · 2.52 KB
/
run_tests.ps1
File metadata and controls
96 lines (81 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Test Runner Script for Windows PowerShell
# Flowfull-Python Client
# License: AGPL-3.0-or-later
param(
[switch]$Coverage,
[switch]$Verbose,
[switch]$Fast,
[switch]$Help
)
function Show-Help {
Write-Host ""
Write-Host "Flowfull-Python Client - Test Runner" -ForegroundColor Cyan
Write-Host "=====================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Usage:" -ForegroundColor Yellow
Write-Host " .\run_tests.ps1 # Run all tests"
Write-Host " .\run_tests.ps1 -Coverage # Run with coverage report"
Write-Host " .\run_tests.ps1 -Verbose # Run with verbose output"
Write-Host " .\run_tests.ps1 -Fast # Skip slow tests"
Write-Host " .\run_tests.ps1 -Help # Show this help"
Write-Host ""
Write-Host "Examples:" -ForegroundColor Yellow
Write-Host " .\run_tests.ps1 -Coverage -Verbose"
Write-Host " .\run_tests.ps1 -Fast"
Write-Host ""
}
if ($Help) {
Show-Help
exit 0
}
# Build pytest command
$pytestArgs = @()
if ($Coverage) {
$pytestArgs += "--cov=core"
$pytestArgs += "--cov-report=html"
$pytestArgs += "--cov-report=term-missing"
}
if ($Verbose) {
$pytestArgs += "-vv"
}
if ($Fast) {
$pytestArgs += "-m"
$pytestArgs += "not slow"
}
# Display header
Write-Host ""
Write-Host "======================================================================" -ForegroundColor Cyan
Write-Host "Running Flowfull-Python Client Tests" -ForegroundColor Cyan
Write-Host "======================================================================" -ForegroundColor Cyan
Write-Host ""
# Run pytest
$command = "pytest"
if ($pytestArgs.Count -gt 0) {
$command += " " + ($pytestArgs -join " ")
}
Write-Host "Command: $command" -ForegroundColor Yellow
Write-Host ""
# Execute
$exitCode = 0
try {
& pytest $pytestArgs
$exitCode = $LASTEXITCODE
} catch {
Write-Host "Error running tests: $_" -ForegroundColor Red
$exitCode = 1
}
# Display footer
Write-Host ""
Write-Host "======================================================================" -ForegroundColor Cyan
if ($exitCode -eq 0) {
Write-Host "✅ All tests passed!" -ForegroundColor Green
} else {
Write-Host "❌ Some tests failed!" -ForegroundColor Red
}
Write-Host "======================================================================" -ForegroundColor Cyan
Write-Host ""
if ($Coverage -and $exitCode -eq 0) {
Write-Host "Coverage report generated at: htmlcov\index.html" -ForegroundColor Yellow
Write-Host ""
}
exit $exitCode