Compare commits

...
3 Commits
Author SHA1 Message Date
christianmanivong eb3a296aff fix(ratchet): refuse a package directory that does not exist
CI / test (3.11) (pull_request) Successful in 36s
CI / test (3.12) (pull_request) Successful in 32s
CI / test (3.13) (pull_request) Successful in 31s
napalm-hpe-aruba-procurve ships napalm_procurve; guessed from its name, the
ratchet measured nothing and wrote an empty baseline without a word.
2026-10-23 10:28:16 +02:00
christianmanivong 6f1789f14a Merge pull request 'fix(ci): longer download timeout and retries for pip and uv' (#3) from fix/pip-retries into main
CI / test (3.11) (push) Successful in 45s
CI / test (3.12) (push) Successful in 32s
CI / test (3.13) (push) Successful in 33s
2026-10-23 08:27:58 +00:00
christianmanivong 9390accb43 fix(ci): longer download timeout and retries for pip and uv
CI / test (3.11) (pull_request) Successful in 26s
CI / test (3.12) (pull_request) Successful in 25s
CI / test (3.13) (pull_request) Successful in 24s
Several jobs on the NAPALM runner failed on ReadTimeoutError from
files.pythonhosted.org on 2026-10-22, none of them on the code.
2026-10-23 08:31:32 +02:00
6 changed files with 40 additions and 1 deletions

No files matched your search

+5
View File
@@ -34,6 +34,11 @@ on:
required: false
env:
# The runner's downloads from PyPI time out now and then (2026-10-22 evening:
# ReadTimeoutError on files.pythonhosted.org in several jobs). Wait longer and retry.
PIP_DEFAULT_TIMEOUT: "60"
PIP_RETRIES: "10"
UV_HTTP_TIMEOUT: "60"
STANDARD: "napalm-standard @ git+https://git.netork.io/NAPALM/driver-standard.git@${{ inputs.standard-ref }}"
jobs:
+5
View File
@@ -13,6 +13,11 @@ The format follows [Keep a Changelog](https://keepachangelog.com/), versions fol
device-types pilot).
### Fixed
- The shared workflow waits 60 s per download and retries ten times, so a slow PyPI
response no longer fails a job.
- `ratchet` refuses a package directory that does not exist. Guessed from the name
(napalm-hpe-aruba-procurve ships `napalm_procurve`), it measured nothing and wrote an
empty baseline without a word.
- `security` audited the runner's own pip instead of the package: pip-audit now
checks a venv holding only the package and its dependencies.
+5 -1
View File
@@ -40,7 +40,11 @@ def _check(args: argparse.Namespace) -> int:
def _ratchet(args: argparse.Namespace) -> int:
code, text = ratchet.run(args.path, _repo(args.path).package, write=args.write)
try:
code, text = ratchet.run(args.path, _repo(args.path).package, write=args.write)
except FileNotFoundError as exc:
print(exc, file=sys.stderr)
return 2
print(text)
return code
+4
View File
@@ -152,6 +152,10 @@ def _lines(source: str) -> int:
def measure(repo: pathlib.Path, package: str) -> dict[str, Any]:
"""Today's excesses, keyed the way the baseline stores them."""
if not (repo / package).is_dir():
raise FileNotFoundError(
f"no package directory {package}/ to measure; name it in [tool.napalm-standard] package"
)
function_lines: dict[str, int] = {}
function_complexity: dict[str, int] = {}
python_file_lines: dict[str, int] = {}
+9
View File
@@ -135,3 +135,12 @@ def test_package_prints_the_import_package(
) -> None:
assert cli.main(["package", str(make_repo())]) == 0
assert capsys.readouterr().out == "napalm_example\n"
def test_ratchet_names_the_missing_package(
make_repo: RepoFactory, capsys: pytest.CaptureFixture[str]
) -> None:
repo = make_repo({"napalm_example/__init__.py": None, "napalm_example/py.typed": None})
assert cli.main(["ratchet", "--write", str(repo)]) == 2
assert "[tool.napalm-standard] package" in capsys.readouterr().err
+12
View File
@@ -308,3 +308,15 @@ def test_check_fails_on_a_problem_and_on_a_stale_entry(tmp_path: pathlib.Path) -
assert code == 1
assert "pkg/mod.py::long = 62 (new)" in text
assert "stale: function_lines: pkg/mod.py::old" in text
def test_a_package_that_does_not_exist_is_an_error_not_an_empty_baseline(
tmp_path: pathlib.Path,
) -> None:
"""procurve's import package is napalm_procurve: guessed from the name, the
ratchet measured nothing and wrote an empty baseline without a word."""
repo = _repo(tmp_path, LONG)
with pytest.raises(FileNotFoundError, match="napalm_missing"):
qr.run(repo, "napalm_missing", write=True)
assert not (repo / qr.BASELINE).exists()