Skip to content

tests: standalone test-suite framework plus the first unit test

Trevor Woerner yocto-patches 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest6 patches 2 repliesIn review
  2. v310 patches 10 repliesSuperseded
  3. v29 patches 0 repliesSuperseded

Changes in v3 from the cover letter

- 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

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6tests: add the standalone unit-test suite skeleton.gitignore README.md justfile +2 more+40 -00 replies
2/6tests: add conftest with a wic-import preflight and session bannertests/conftest.py+28 -00 replies
3/6tests: add optional coverage reporting.gitignore justfile pyproject.toml+12 -00 replies
4/6add ruff linting.gitignore justfile pyproject.toml+18 -00 replies
5/6bb/utils: import errno so mkdirhier's OSError handler workssrc/wic/bb/utils.py+1 -00 replies
6/6tests/unit/test_bb_utils: cover mkdirhier()tests/unit/.gitkeep tests/unit/test_bb_utils.py+81 -00 replies

Reviews trailers per patch

None of the 6 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchPaul Barker
SeriesR-b
1/6
2/6
3/6
4/6
5/6
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [wic][PATCH v4 0/6] tests: standalone test-suite framework plus the first unit test

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
Signature · 1 line
2.50.0.173.g8b6f19ccfc3a