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
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:
@@ -0,0 +1,7 @@
|
||||
"""Fill Resistance - DC resistance of copper zone fills and traces.
|
||||
|
||||
__version__ is the runtime source of truth (metadata.json and
|
||||
pyproject.toml are not deployed with the plugin); a test keeps the
|
||||
three in sync.
|
||||
"""
|
||||
__version__ = "1.3.0"
|
||||
|
||||
@@ -7,7 +7,7 @@ from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
|
||||
from . import config
|
||||
from . import __version__, config
|
||||
from .geometry import Problem, save_problem
|
||||
from .raster import RasterStack
|
||||
from .solver import Result
|
||||
@@ -59,9 +59,10 @@ def write_summary(outdir: Path, problem: Problem, stack: RasterStack,
|
||||
result: Result) -> Path:
|
||||
ny, nx = stack.shape2d
|
||||
info = result.solve_info
|
||||
head = f"fill_resistance {__version__} summary"
|
||||
lines = [
|
||||
"fill_resistance summary",
|
||||
"=======================",
|
||||
head,
|
||||
"=" * len(head),
|
||||
f"board: {problem.board_path}",
|
||||
f"net: {problem.net_name}",
|
||||
f"test current: {result.i_test:g} A",
|
||||
|
||||
@@ -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]
|
||||
Reference in New Issue
Block a user