From 34409742172d7c57a0d566f647383fad59e307ee Mon Sep 17 00:00:00 2001 From: loggger101 Date: Tue, 27 Oct 2026 03:32:36 -0400 Subject: [PATCH] Tests: samebytes v0.5.0; config help and every git pin at one ref test_rules.py holds LaunchConfig's fields to a help comment and every github.com/loggger101 pin to one ref. port_tries gets its own comment: the one above it reached port_first only. CI's hooks job moves off samebytes v0.1.0 to the test extra's tag. --- .github/workflows/tests.yml | 5 +++-- CHANGELOG.md | 4 ++++ pyproject.toml | 6 ++++-- quietlaunch/launcher.py | 2 +- tests/test_rules.py | 33 ++++++++++++++++++++++++++++++--- 5 files changed, 42 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 97f5d67..716c835 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,7 +38,8 @@ jobs: # .githooks/ holds samebytes' stat-cache hook (this tree lives in a synced # folder). Drift, CRLF, a missing eol=lf pin or a missing executable bit # each make a copy silently useless after a checkout; this fails on any of - # them. The tag is the samebytes release the copies came from. + # them. The tag is the one pyproject's test extra pins (tests/test_rules.py + # holds the two to one ref); the hooks are unchanged since samebytes v0.1.0. hooks: runs-on: ubuntu-latest steps: @@ -48,5 +49,5 @@ jobs: python-version: "3.14" - name: Hooks match samebytes run: | - python -m pip install "samebytes @ git+https://github.com/loggger101/samebytes@v0.1.0" + python -m pip install "samebytes @ git+https://github.com/loggger101/samebytes@v0.5.0" python -m samebytes hooks check . diff --git a/CHANGELOG.md b/CHANGELOG.md index 522469e..29ab0ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ test extra), the copy the family shares. The import rule now answers on Python 3.9 instead of skipping there, and async definitions need a docstring too. +- samebytes v0.5.0 in the test extra and in CI's `hooks` job, which had sat on + v0.1.0; `tests/test_rules.py` holds every git pin to one ref and every + `LaunchConfig` field to a help comment. `port_tries` gets its own: the + comment above it was written for `port_first` and reached only that field. ## v0.1.0 (2026-10-20) diff --git a/pyproject.toml b/pyproject.toml index 358b92b..479a10a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,8 +46,10 @@ dependencies = [] [project.optional-dependencies] # samebytes is the house-rule checks tests/test_rules.py calls (docs and -# source); test-only, so the package itself still depends on nothing new. -test = ["pytest>=7.0", "samebytes @ git+https://github.com/loggger101/samebytes@v0.3.0"] +# source, the config's help and the git pins among them); test-only, so the +# package itself still depends on nothing new. CI's hooks job pins it again; +# tests/test_rules.py holds the two together. +test = ["pytest>=7.0", "samebytes @ git+https://github.com/loggger101/samebytes@v0.5.0"] [project.urls] Repository = "https://github.com/loggger101/quietlaunch" diff --git a/quietlaunch/launcher.py b/quietlaunch/launcher.py index 668c737..75fb8ae 100644 --- a/quietlaunch/launcher.py +++ b/quietlaunch/launcher.py @@ -103,7 +103,7 @@ class LaunchConfig: state_dir: Optional[str] = None # Ports tried, from `port_first` upwards. port_first: int = PORT_FIRST - port_tries: int = PORT_TRIES + port_tries: int = PORT_TRIES # how many ports, counting port_first # How long a boot may take before it is reported as failed. boot_timeout_s: float = BOOT_TIMEOUT_S # Install Streamlit on first use if it is not importable. diff --git a/tests/test_rules.py b/tests/test_rules.py index 89dc268..29c79b7 100644 --- a/tests/test_rules.py +++ b/tests/test_rules.py @@ -1,14 +1,15 @@ # -*- coding: utf-8 -*- """The package's own rules: standard library only, ASCII only, documented. -The rules are samebytes' (`samebytes.source`), the one copy the repositories -in this family share; what they read is this package's. +The rules are samebytes' (`samebytes.source`, `samebytes.docs`), the one copy +the repositories in this family share; what they read is this package's. """ +import dataclasses import os import pytest -from samebytes import source +from samebytes import docs, source import quietlaunch @@ -47,3 +48,29 @@ def test_every_definition_has_a_docstring(path): def test_version_is_the_one_pyproject_reads(): """pyproject.toml takes its version from `quietlaunch.__version__`.""" assert source.version_written_once(ROOT, "quietlaunch") == ([], 1) + + +def test_every_config_field_has_help(): + """Every `LaunchConfig` field carries a help comment. + + Read by samebytes' `source.field_docs`: the block directly above a field, + to the first blank line, banner or bare rule, plus a trailing comment. A + block explains only the field below it, so `port_tries`, under the + comment written for both port fields, had none until this test. + """ + from quietlaunch.launcher import LaunchConfig + fields = [f.name for f in dataclasses.fields(LaunchConfig)] + bad, n = source.missing_help(ROOT, "quietlaunch/launcher.py", "LaunchConfig", fields=fields) + assert bad == [] and n == len(fields), "; ".join(bad) + + +def test_git_pins_agree(): + """Every `github.com/loggger101/@` names one ref per repository. + + samebytes is pinned in pyproject's test extra and in CI's hooks job; the + hooks job sat on v0.1.0 while the test extra moved to v0.3.0. CHANGELOG is + left out: an old pin there is history. + """ + files = ["pyproject.toml", ".github/workflows/tests.yml", "README.md", "CLAUDE.md"] + bad, n = docs.pins(ROOT, files, "loggger101") + assert bad == [] and n >= 3, "; ".join(bad)