Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/rte7000_tht/grids/grid_437818d6/network.xiidm.gz.b64

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/rte7000_tht/grids/grid_5384e039/network.xiidm.gz.b64

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/rte7000_tht/grids/grid_5fc376c7/network.xiidm.gz.b64

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion data/rte7000_tht/grids/grid_e4e81e29/network.xiidm.gz.b64

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions scripts/game_mode/test_rte7000_game_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,25 @@ def test_every_grid_ships_a_decodable_network():
assert len(raw) > 1_000_000 # ~8.8 MB XML, not a truncated stub


def test_network_iidm_version_is_readable_by_the_pinned_pypowsybl():
"""The networks must serialise at an IIDM schema the deployed pypowsybl can
read. pyproject pins pypowsybl>=1.13,<1.15, and pypowsybl 1.14 rejects
IIDM 1.16 ("Unsupported file format") — so the shipped transports must be
IIDM <= 1.14. Guards against re-shipping a network exported by a newer
pypowsybl (which defaults to 1.16)."""
import re
max_major, max_minor = 1, 14
for enc in sorted(GRIDS.glob("*/network.xiidm.gz.b64")):
raw = gzip.decompress(base64.b64decode(enc.read_bytes()))
m = re.search(rb"iidm/(\d+)_(\d+)", raw[:400])
assert m, f"no IIDM version in {enc.parent.name}/network.xiidm"
major, minor = int(m.group(1)), int(m.group(2))
assert (major, minor) <= (max_major, max_minor), (
f"{enc.parent.name}: IIDM {major}.{minor} > 1.14 — the pinned "
f"pypowsybl (<1.15) cannot read it; re-export with "
f"parameters={{'iidm.export.xml.version': '1.14'}}")


# --------------------------------------------------------------------------- #
# DB <-> frontend JSON <-> on-disk assets consistency
# --------------------------------------------------------------------------- #
Expand Down
Loading