[wic][PATCH v4 0/6] tests: standalone test-suite framework plus the first unit test
Trevor Woerner <[email protected]> Mon, 6 Jul 2026 18:28:58 -0400
| Newsgroups | org.yoctoproject.lists.yocto-patches |
|---|---|
| Message-ID | <[email protected]> |
wic has no test mechanism of its own; it relies on the oe-selftest from
oe-core, which needs a full bitbake build to exercise even pure-Python
logic. This series starts a small standalone suite that runs from a
plain checkout, framework first, then the first fix, and its test.
- the suite skeleton (pyproject test extra, pytest config, layout,
a justfile command runner, and a README Testing section);
- a conftest that imports wic once up front (stopping the session with
a clear message if that fails) and prints a session banner;
- optional coverage and ruff linting, each exposed as just recipes;
- a one-line fix to wic.bb.utils (import errno) so mkdirhier's OSError
handler works, as its own commit;
- unit tests for mkdirhier() that pin its behaviour and catch that
bug.
The suite is green at every commit and the test tree is ruff-clean.
Changes in v4 (in response to review feedback, thanks to Paul Barker):
v4 restructures the v3 10-patch series into 6 patches. How the old
patches map to the new ones:
- v3 1/10 (skeleton) -> v4 1/6, which also gains a justfile command
runner in place of the run-tests.sh wrapper and no longer creates a
tests/docs/ tree;
- v3 2/10 (conftest banner) -> v4 2/6, which also absorbs the
wic-import check (see next line);
- v3 3/10 (run-tests.sh wrapper) -> dropped; the justfile replaces it
and its wic-import check moves into conftest, so the check runs on
every invocation rather than only through the wrapper;
- v3 4/10 (coverage) -> v4 3/6, exposed as just recipes;
- v3 5/10 (ruff linting) -> v4 4/6, exposed as just recipes, with
ruff now pinned exactly so the clean-bar gate is reproducible;
- v3 8/10 (tests/** E402 ignore) -> folded into v4 4/6;
- v3 6/10, 7/10, 10/10 (docs README, authoring guide, review rubric)
-> dropped; the suite ships a short README Testing section instead
of a tests/docs/ tree;
- v3 9/10 (test plus folded-in errno fix) -> split into v4 5/6 (the
errno fix, on its own, first) and v4 6/6 (the tests), and the tests
are reframed to target mkdirhier's own behaviour rather than
re-testing os.makedirs.
Dependency versions were also refreshed to current releases.
Changes in v3:
- test_bb_utils used the tmp_path fixture instead of
tempfile.mkdtemp(), so the tests no longer leaked scratch
directories under /tmp;
- documented the standard pytest scratch-directory controls (TMPDIR
and --basetemp) rather than a custom variable;
- added a review-rubric doc.
Changes in v2:
- v1 was a single ~6000-line commit that used xfail markers to record
the bugs it found; v2 broke the work into a reviewable series where
each test lands green next to the fix that makes it pass, with no
xfails.
Trevor Woerner (6):
tests: add the standalone unit-test suite skeleton
tests: add conftest with a wic-import preflight and session banner
tests: add optional coverage reporting
add ruff linting
bb/utils: import errno so mkdirhier's OSError handler works
tests/unit/test_bb_utils: cover mkdirhier()
.gitignore | 4 ++
README.md | 15 +++++++
justfile | 27 +++++++++++++
pyproject.toml | 24 +++++++++++
src/wic/bb/utils.py | 1 +
tests/conftest.py | 28 +++++++++++++
tests/unit/test_bb_utils.py | 81 +++++++++++++++++++++++++++++++++++++
7 files changed, 180 insertions(+)
create mode 100644 justfile
create mode 100644 tests/conftest.py
create mode 100644 tests/unit/test_bb_utils.py
--
2.50.0.173.g8b6f19ccfc3a