Test Suite

Sparlectra uses profile-aware test loading through test/runtests.jl. Profile selection precedence is:

  1. CLI argument (julia --project=. test/runtests.jl <profile>)
  2. SPARLECTRA_TEST_PROFILE
  3. default fast

Test profiles

ProfileCommandScopeIntended use
fast (default)julia --project=. test/runtests.jl fastCore offline testsNormal local development and default CI smoke
extendedjulia --project=. test/runtests.jl extendedFast + integration/heavier testsBefore merge and after configuration, MATPOWER, or integration changes
alljulia --project=. test/runtests.jl allCurrently alias for extendedReserved for future all-only suites and CI matrix clarity

Pkg.test() uses the same test runner and therefore the default fast profile unless SPARLECTRA_TEST_PROFILE is set:

julia --project=. -e 'using Pkg; Pkg.test()'

Fast profile groups

GroupFilesMain checks
core_modeltest/testgrid.jlCore net construction and validation, inline MATPOWER import helpers, link handling, shunts, reporting/output checks, and summary-file output regression
powerflow_rectangulartest/test_solver_interface.jlRectangular power-flow API behavior, sparse-only solver path, Q-limit and typed configuration entry checks
configurationtest/test_configuration_coverage.jlConfiguration-key coverage, forwarding checks, and value-domain validation
state_estimationtest/test_state_estimation.jlWLS state-estimation behavior and observability-oriented regressions
controlstest/test_voltage_dependent_control.jl, test/test_transformer_phase_shift.jl, test/test_tap_controller.jlVoltage-dependent controls, transformer phase-shift control, and tap-controller behavior

Extended profile additions

Extended additionFileMain checks
removetest/testremove.jlRemove/delete behavior and consistency after structural edits
pv_voltage_residualstest/test_pv_voltage_residuals.jlPV-voltage residual behavior and related solver diagnostics
matpower_exampletest/test_matpower_example.jlMATPOWER example runner path, output routing, performance/profile rendering, and runtime configuration forwarding
synthetic_gridstest/test_synthetic_grids.jlSynthetic network generation and larger synthetic-grid regression coverage
configuration_docstest/test_configuration_docs.jlConfiguration documentation and docs/config consistency checks

Offline and runtime expectations

The default fast profile is intended to be offline-safe and should not download MATPOWER cases or run benchmark loops.

The extended profile may include MATPOWER/example/output-heavy tests. These tests stay isolated from the default profile.

Use fast during normal development. Use extended before merging changes that affect configuration, MATPOWER import, output formatting, performance reporting, or broader integration paths.

Pre-merge verification gate (config / MATPOWER / output / performance / docs changes)

For branches that touch central configuration, MATPOWER runner behavior, output routing/formatting, performance reporting, or documentation/config consistency, complete this checklist before merge:

Bash

julia --project=. -e 'using Pkg; Pkg.instantiate()'
julia --project=. test/runtests.jl
SPARLECTRA_TEST_PROFILE=extended julia --project=. test/runtests.jl
julia --project=docs docs/make.jl

PowerShell

julia --project=. -e 'using Pkg; Pkg.instantiate()'
julia --project=. test/runtests.jl

$env:SPARLECTRA_TEST_PROFILE="extended"
julia --project=. test/runtests.jl
Remove-Item Env:SPARLECTRA_TEST_PROFILE

julia --project=docs docs/make.jl

This keeps the default local workflow fast while making the extended profile and docs build an explicit pre-merge gate for integration-heavy changes.

Output-summary regression note

The fast profile includes a regression for printACPFlowResults(...; toFile=true, result_mode=:summary). It verifies that the result file is closed/flushed before the function returns and that the summary contains Q-limit counter labels. Equivalent environment-variable usage remains supported:

SPARLECTRA_TEST_PROFILE=extended julia --project=. test/runtests.jl

Progress output

The runner prints a lightweight progress view, for example:

Test framework: fast
[1/5] core_model
[2/5] powerflow_rectangular
...

Julia's final Test Summary remains unchanged and visible at the end.

Rectangular/Q-limit diagnostics in tests

The rectangular convergence and Q-limit active-set diagnostic block is not printed in normal test runs. Those diagnostics remain available only through explicit diagnostic requests (for example solver verbose > 0 paths used during focused debugging).