Cover every option in the help, the manual and the readme, and say what to install
An audit rather than a feature, prompted by wanting this fit to hand to somebody else. Five options had no command-line flag written down in the table the manual is generated from -- location, hold, schedules, tile_url and speed_unit -- so five flags that exist were missing from the manual. Four of them did exist under other names and are now recorded; hold had no flag at all and has one. Four switches could be turned off from the command line and not back on: --no-lookup, --no-basemap, --no-airports and --no-labels had no positive halves, so an option turned off in the saved settings could not be turned on again for one run. All four now have both. And adsb, which opens the window and draws a map when it stops, could not be given any of the settings that decide what those look like: no --at, no --radius, no --tiles, no --map-brightness, no --width, --fps, --trail, --fade, --stale, --airports or --labels. It takes all of them now. The manual had no list of the aircraft options at all -- the ADS-B sections were hand-written prose -- so five of them appeared nowhere in it. It now generates an AIRCRAFT OPTIONS section from the same table the menu and the flags come from, and the readme carries a table of all thirty-four with their flags and defaults. Three tests hold the three of them together: one that every option records its flag, one that every flag the table claims actually exists on a command, and one that the readme names them all. The installing instructions now list every dependency rather than only the optional ones: the four Python packages with their names in Debian, Fedora and Arch, and librtlsdr, which is a C library and therefore the one thing pip cannot bring and a virtual environment cannot supply. What reaches a network is written down too -- which host, when, and which file it is cached in -- since somebody installing this on a metered or air-gapped machine has to be able to see that nothing is fetched behind their back. build-repo.sh needs dpkg-dev and apt-utils, which a minimal system does not have, and now says so. Verified rather than asserted: a clean virtual environment, pip install from this tree, and a real log read back through the installed command. It pulls seven wheels rather than the four the page claimed, the other three being what Rich brings with it. Also: matplotlib is gone from the readme's dependency table, nothing having imported it; ffmpeg and Qt are in it, both having been missing; ffmpeg is a Suggests on the package; and resume.sh is ignored. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016PsWPTweCT6pwxKngvVxcg
This commit is contained in:
parent
6d2436cde1
commit
8ed01f991f
16 changed files with 1012 additions and 46 deletions
|
|
@ -527,3 +527,68 @@ def test_a_group_number_at_the_top_does_not_edit_the_option_of_that_number(
|
|||
run(monkeypatch, console, ["1", "b", "b"], ScanConfig())
|
||||
assert held.seconds == was
|
||||
assert held.device == air.AircraftOptions().device
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Every option reachable from the command line as well as the menu
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def _help_for(command: str) -> str:
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
return subprocess.run([sys.executable, "-m", "bandsaunter.cli", command,
|
||||
"--help"], capture_output=True, text=True,
|
||||
timeout=120).stdout
|
||||
|
||||
|
||||
def test_every_option_records_the_flag_that_sets_it():
|
||||
"""The manual is generated from this table, so an option whose flag is
|
||||
not written down here is a flag the manual does not mention."""
|
||||
missing = [o.key for o in air.OPTIONS if not (o.flags or o.off_flags)]
|
||||
assert missing == [], missing
|
||||
|
||||
|
||||
def test_every_flag_the_table_claims_actually_exists():
|
||||
"""The other way round: a flag written down here and never added to a
|
||||
parser is a promise the program does not keep."""
|
||||
both = _help_for("adsb") + _help_for("flights")
|
||||
for option in air.OPTIONS:
|
||||
for flag in tuple(option.flags) + tuple(option.off_flags):
|
||||
assert flag in both, f"{option.key}: {flag} is on no command"
|
||||
|
||||
|
||||
def test_a_switch_can_be_turned_back_on_as_well_as_off():
|
||||
"""An option turned off in the saved settings could not be turned back
|
||||
on for one run: only the off half of each pair had a flag."""
|
||||
both = _help_for("adsb") + _help_for("flights")
|
||||
for key in ("lookup", "basemap", "airports", "labels"):
|
||||
option = air.by_key(key)
|
||||
assert option.flags and option.off_flags, key
|
||||
for flag in tuple(option.flags) + tuple(option.off_flags):
|
||||
assert flag in both, f"{key}: {flag}"
|
||||
|
||||
|
||||
def test_the_window_takes_the_options_it_draws_with():
|
||||
"""adsb opens the window and draws a map when it stops, so it has to
|
||||
accept the settings that decide what those look like."""
|
||||
text = _help_for("adsb")
|
||||
for flag in ("--at", "--radius", "--theme", "--map-brightness", "--tiles",
|
||||
"--rings", "--window-rings", "--box-opacity", "--fade",
|
||||
"--hold", "--speed-unit"):
|
||||
assert flag in text, flag
|
||||
|
||||
|
||||
def test_the_readme_lists_every_option_and_its_flag():
|
||||
"""The readme carries a table of them. A table written by hand goes
|
||||
stale the first time an option is added, so this says when it has."""
|
||||
from pathlib import Path
|
||||
|
||||
readme = Path(__file__).resolve().parent.parent / "README.md"
|
||||
if not readme.exists(): # an installed copy has none
|
||||
pytest.skip("no README beside the tests")
|
||||
text = readme.read_text()
|
||||
for option in air.OPTIONS:
|
||||
assert f"| {option.label} |" in text, f"{option.key} is not in README"
|
||||
for flag in tuple(option.flags) + tuple(option.off_flags):
|
||||
assert f"`{flag}`" in text, f"{option.key}: {flag} is not in README"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue