jw-pkg/test/unit/python
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Jan Lindemann 42f6c1d14b
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 10m28s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m14s
CI / Packaging test (pull_request) Successful in 0s
lib.ExecApp: Add class
ExecApp is a ready-made base class for applications that operate
through an ExecContext: it adds the --interactive, --verbose and
--target options, exposes interactive, verbose and exec_context
properties, and closes the exec context when the async context
manager exits.

The code for that has lived in jw.pkg.App code before, which now
inherits from ExecApp.

A fix along the way: __aexit__() closes the exec context and then chains
to super().__aexit__(), so App.close() runs when the async context
manager exits. Before the change, exiting the async context left the app
unclosed; close() ran only on the run() path. Add a unit test that
builds an ExecApp with a root command and asserts that close() runs on
context exit and that the exec options are registered.

The exec options are now registered before App's own options,
which moves them up in the rendered --help output. Update the
golden file of the help integration test to match.

Signed-off-by: Jan Lindemann <jan@janware.com>
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.84.2
2026-08-22 17:17:09 +02:00
..
jw lib.ExecApp: Add class 2026-08-22 17:17:09 +02:00
Makefile jw.pkg.lib.Uri: Add unit test 2026-06-25 19:08:02 +02:00