Commit graph jw-pkg/test/integration
Author SHA1 Message Date
1385b1a4ba lib.ExecApp: Add class
All checks were successful
CI / Packaging - Kali Linux (push) Successful in 11m50s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m14s
CI / Packaging test (push) Successful in 0s
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:31:57 +02:00
2eeaaf9681
lib.App: Make default log values overridable
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m0s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m11s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 3m40s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 3m59s
CI / Packaging test (push) Successful in 0s
The __init__() method reads default log configuration directly
from environment variables, making it impossible for subclasses to
change defaults.

Extract the defaults into _default_log_flags(), _default_log_level(),
_default_log_file(), and _default_show_backtrace() methods, then call
them from __init__(). Subclasses can now override these methods to
customize defaults without needing to override the entire __init__()
method.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-08-10 20:26:40 +02:00
41ca202142
cmds.projects.CmdBuild: Support --dep-flavours
CmdBuild supports the targets all, clean and pkg-*. It uses builtin
dependency flavours matching those targets to resolve build order. To
make it more flexible in general, and allow it to support more
targets, e.g. "check" and "test", this commit adds a --dep-flavours
option.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:35:27 +02:00
100d8f9abb
test/integration/jw-pkg/projects/cache: Add directory
Add tests for jw-pkg.py calls run during makefile caching. Broken
caching can compromise the build without causing it to fail entirely,
i.e. in non-obvious ways.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:23:52 +02:00
c8ffae57fc
test/integration/jw-pkg/projects: Add directory
Add a directory for integration tests of "jw-pkg projects".

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:22:37 +02:00
1062be24db
App: Remove hardcoded local/src from App and defs.mk
local/src is a janware-specific path, remove it from App and defs.mk.
It's still in pkg.sh as a safety measure. Will have to go, too, but
is kept in for now until further audit.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-24 13:20:18 +02:00
670472abf5
cmds.CmdPlatform: Fix typo "comamnds" -> "commands"
CmdPlatform's help message contains the string "comamnds", fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-07-22 11:06:58 +02:00
45f8e8cc89
test + python-tools.sh: Fix toplevel "make all" fallout
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m14s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m20s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 3m45s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 3m52s
CI / Packaging test (push) Successful in 0s
After a pipeline change, CI now runs "make all" in a repo's root,
which uncovers two problems:

1. The help integration test only succeeded as long CI didn't run
   "make all" before "make test". That way, the checked out
   repository lacked the generated __init__.py files needed for some
   modular subcommands to be fully loaded, and hence, the test should
   have failed. The entire machinery only worked because the
   subcommands in question are not not essential to building jw-pkg
   itself: "secrets" and "posix". So, this commit adapts the help
   integration test to the new reality.

2. Regarding python-tools.sh: Commit 55060486 satisfies yapf in some
   places of the source code, but in others not anylonger.  So patch
   python-tools.sh's newline handling again.

While not thematically similar, both fixes get baked into one commit
to satisfy the requirement that every single commit needs to pass
"make clean all check test" individually.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-25 18:28:36 +02:00
efc5bc1c60
test: Add subdirectory with integration test
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 3m38s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 3m39s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m21s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m32s
CI / Packaging test (push) Successful in 0s
Add a test/integration subdirectory as a location for integration
tests. The first tests that are added are unproblematic in that they
don't need superuser privileges to run:

  - help: Recursively check if jw-pkg.py's help messages are unchanged

  - packages ls: Check if the bash package exists and contains

      /usr/bin/bash
      /usr/bin/bashbug

Let's see how that fares in CI.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-06-25 14:40:53 +02:00