Testing Suite
The test suite includes unit tests (no PowerWorld required) and integration tests (requires PowerWorld Simulator with a valid case file).
Test Coverage
Unit Tests — Run without PowerWorld
File |
Coverage |
|---|---|
|
GObject base class, FieldPriority flags, repr/str methods |
|
Field collection, key/editable/settable classification |
|
Indexable data access syntax, broadcast, bulk update |
|
SAW helpers: df_to_aux, path conversion, formatting, GICOption descriptor mechanics |
|
Dynamics module: ContingencyBuilder, SimAction enum |
|
Utility modules: timing decorator, B3D file format |
|
BusCat string parsing: all known PowerWorld BusCat variants (Slack, PV, PQ with controls/roles/limits) |
Integration Tests — Require PowerWorld
File |
Coverage |
|---|---|
|
Core SAW operations, file I/O, data retrieval |
|
PowerWorld data access, indexing, solver option descriptors, convenience features (flows, overloads, snapshot, PTDF, LODF, properties, summary) |
|
Power flow, matrices (Ybus, Jacobian), PTDF/LODF |
|
Contingency auto-insertion, solving, OTDF |
|
BusCat module: refresh, index methods, voltage setpoints, classification DataFrame |
|
Network topology, incidence matrices, graph analysis |
|
GIC analysis, calculations, GIC option descriptors, G-matrix comparison |
|
Case modification and data manipulation |
|
Scheduled actions, weather, OPF, extended methods |
|
Transient stability simulation |
Configuration
Copy
tests/config_test.example.pytotests/config_test.pySet
SAW_TEST_CASE = r"C:\Path\To\Your\Case.pwb"
Running Tests
pytest tests/ # Full suite
pytest tests/ -m unit # Unit only
pytest tests/ -m integration # Integration only
pytest tests/ --cov=esapp --cov-report=html # With coverage
Troubleshooting
PowerWorld not found: Ensure
tests/config_test.pyexists with valid case pathIntegration tests slow: Use
pytest -m "not integration"for unit-only runsImport errors: Install in editable mode with
pip install -e .