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
5 changes: 3 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 .
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]"]
# 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/[email protected]"]

[project.urls]
Repository = "https://github.com/loggger101/quietlaunch"
Expand Down
2 changes: 1 addition & 1 deletion quietlaunch/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
33 changes: 30 additions & 3 deletions tests/test_rules.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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/<repo>@<ref>` 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)
Loading