Re: [yocto-patches] [wic][PATCH] tests: add a standalone unit-test suite for wic's pure-Python logic
Paul Barker <[email protected]> Mon, 29 Jun 2026 09:06:48 +0100
| Newsgroups | org.yoctoproject.lists.yocto-patches |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 2026-06-26 at 14:45 -0400, Trevor Woerner via lists.yoctoproject.org wrote: > wic currently has no test mechanism of its own; it relies on the > oe-selftest from oe-core for all its testing, which means a full > bitbake build is needed to exercise even pure-Python logic. Add a > small standalone suite that runs from a plain checkout with nothing > but pytest (and ruff for linting), so that logic can be pinned down > and kept stable as the code evolves. > > What this adds: > > - tests/conftest.py: a session banner identifying what the run is > tested against. > - tests/run-tests.sh: a small wrapper that runs the suite from > anywhere in the checkout. > - tests/unit/: in-process unit suites for wic's pure-Python > modules. > - tests/docs/: how to run the suite and the conventions it follows. > - pyproject.toml: a [tests] optional-dependency group and the > pytest and ruff configuration. > - README.md: a Testing section pointing at the suite and its docs. > - .gitignore: ignore the coverage data file. > > Install and run with: > > pip install -e ".[tests]" > tests/run-tests.sh > > The suite follows a test-driven style: each test states the > behaviour wic is expected to provide. Where a behaviour is not yet > in place, the test is written ahead of the implementation and > marked xfail, so the specification is captured in the test itself. > The test code itself is kept ruff-clean (see tests/docs/linting.md). > > AI-Generated: codex/claude-opus 4.7 (xhigh) > Signed-off-by: Trevor Woerner <[email protected]> > --- > .gitignore | 6 + > README.md | 28 + > pyproject.toml | 30 + > tests/conftest.py | 38 + > tests/docs/README.md | 77 + > tests/docs/authoring.md | 97 ++ > tests/docs/linting.md | 50 + > tests/docs/philosophy.md | 84 ++ > tests/run-tests.sh | 135 ++ > tests/unit/test_bb_utils.py | 133 ++ > tests/unit/test_bootfiles.py | 188 +++ > tests/unit/test_cli_types.py | 288 ++++ > tests/unit/test_engine.py | 282 ++++ > tests/unit/test_filemap.py | 2317 +++++++++++++++++++++++++++++ > tests/unit/test_help.py | 118 ++ > tests/unit/test_ksparser_parse.py | 209 +++ > tests/unit/test_ksparser_types.py | 400 +++++ > tests/unit/test_misc.py | 128 ++ > tests/unit/test_misc_vars.py | 182 +++ > tests/unit/test_oe_path.py | 465 ++++++ > tests/unit/test_partition.py | 598 ++++++++ > tests/unit/test_pluginbase.py | 93 ++ > tests/unit/test_update_fstab.py | 265 ++++ > 23 files changed, 6211 insertions(+) Hi Trevor, Thanks for sending this, I think it's important to add a standalone test suite to wic. 6211 new lines in one patch isn't reviewable though. Please separate this into a logical series of smaller changes. I also recommend fixing issues in the wic code as you go instead of capturing them in xfail conditions. That is much easier if you take this one step at a time. An initial series could add the test framework, add one test module and fix the errors along the way (e.g. in mkdirhier()). Best regards, -- Paul Barker
signature.asc
(application/pgp-signature, 252 B)
-----BEGIN PGP SIGNATURE----- iIcEABYKAC8WIQSzjPXf5Y1BDWhU2iCrY1Tsnbr0bgUCakInmBEccGF1bEBwYmFy a2VyLmRldgAKCRCrY1Tsnbr0bvgIAP4qCfDmBL4J3DPIUTT2Z7KCeqByWfvctKKW zxTorq8iOwD/Z3CNMZQCzBsdGi2+hGDwCKs2ho6mDA0vsSy855NLaAk= =zl/d -----END PGP SIGNATURE-----