Show the plugin version in summary.txt
Build PCM package / build (push) Successful in 5s
tests / ubuntu-latest · py3.11 (push) Successful in 1m32s
tests / ubuntu-latest · py3.13 (push) Successful in 1m8s
tests / archlinux:latest (push) Successful in 31s
tests / debian:12 (push) Successful in 40s
tests / fedora:latest (push) Successful in 52s
tests / ubuntu:24.04 (push) Successful in 56s
tests / NixOS (FHS wrapper from docs/NIXOS.md) (push) Has been skipped

fill_resistance.__version__ is the runtime source (metadata.json and
pyproject.toml are excluded from deployment); a test pins all three
to the same number.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
janik
2026-07-24 17:16:04 +07:00
co-authored by Claude Fable 5
parent 8aff1c0be9
commit 31ef356345
3 changed files with 44 additions and 3 deletions
+33
View File
@@ -0,0 +1,33 @@
"""fill_resistance.__version__ is the runtime source of the version:
it must match the packaging metadata (which is not deployed with the
plugin) and show up in summary.txt."""
import json
import re
from pathlib import Path
import fill_resistance
from fill_resistance import raster, report, solver
from tests.util import NM, strip_problem
ROOT = Path(__file__).resolve().parent.parent
def test_version_matches_packaging_metadata():
meta = json.loads((ROOT / "metadata.json").read_text(encoding="utf-8"))
assert meta["versions"][0]["version"] == fill_resistance.__version__
pyproject = (ROOT / "pyproject.toml").read_text(encoding="utf-8")
m = re.search(r'^version = "([^"]+)"', pyproject, re.M)
assert m is not None
assert m.group(1) == fill_resistance.__version__
def test_summary_shows_version(tmp_path):
problem = strip_problem()
stack = raster.rasterize_stack(problem, 1.0 * NM)
e1, e2 = raster.electrode_masks(stack, problem)
result = solver.run_solve(problem, stack, e1, e2, 1.0,
contact_model="equipotential")
text = report.write_summary(tmp_path, problem, stack,
result).read_text(encoding="utf-8")
assert fill_resistance.__version__ in text.splitlines()[0]