-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_tests.ps1
More file actions
39 lines (31 loc) · 1.05 KB
/
run_tests.ps1
File metadata and controls
39 lines (31 loc) · 1.05 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
# Run tests with coverage ONLY (no XML, no durations), showing pytest’s usual summary.
# It also overrides any configured addopts (e.g. durations/xml) via `-o addopts=`.
#
# Usage:
# .\scripts\run_tests.ps1
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version Latest
# Pick test paths
[string[]]$TestPaths = if ($args.Count -ge 1) { $args } else { @('tests') }
# Resolve repo root (this script lives in scripts/)
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$RepoRoot = Resolve-Path (Join-Path $ScriptDir '..')
# Use Poetry if available and pyproject exists
$RunWithPoetry = (Get-Command poetry -ErrorAction SilentlyContinue) -and (Test-Path (Join-Path $RepoRoot 'pyproject.toml'))
# Headless backend if plots are generated during tests
if (-not $env:MPLBACKEND) { $env:MPLBACKEND = 'Agg' }
Set-Location $RepoRoot
# Build command
$cmd = @()
if ($RunWithPoetry) { $cmd += @('poetry', 'run') }
$cmd += 'pytest'
$cmd += @(
'-o', 'addopts=',
'--cov=src',
'--cov-report=term',
'--disable-warnings',
'-q'
)
$cmd += $TestPaths
# Execute
& $cmd