From: Trevor Woerner <twoerner@gmail.com>
To: yocto-patches@lists.yoctoproject.org
Subject: [wic][PATCH v3 01/10] tests: add the standalone test-suite skeleton
Date: Wed, 1 Jul 2026 03:40:21 -0400 [thread overview]
Message-ID: <20260701074030.1090807-2-twoerner@gmail.com> (raw)
In-Reply-To: <20260701074030.1090807-1-twoerner@gmail.com>
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. This
commit lays the groundwork for a small standalone suite that runs
from a plain checkout with nothing but pytest, so that logic can be
pinned down and kept stable as the code evolves.
This commit adds the skeleton only; it does not add any tests.
What this adds:
- pyproject.toml: a "tests" optional-dependency group (pytest only)
so that "pip install -e .[tests]" pulls in what the suite needs,
plus a [tool.pytest.ini_options] section. The pytest options keep
a test's scratch directory only when that test fails, so repeated
runs do not accumulate leftover files.
- tests/unit/ and tests/docs/: the directories that hold the
in-process unit suites and the suite documentation. Git cannot
track an empty directory, so a placeholder .gitkeep is committed
in each to create it. The .gitkeep files have no content and are
removed once real files land in those directories.
- .gitignore: ignore the .pytest_cache/ directory that pytest
writes at the top of the checkout.
- README.md: a Testing section pointing at the suite and at
tests/docs/, and a tests/* entry in the project layout list.
AI-Generated: codex/claude-opus 4.7 (xhigh)
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
changes in v3:
- no change in this revision.
changes in v2:
- v1 submitted the entire test suite as a single commit; v2 breaks
the work into a reviewable series, and this patch is one step of it.
---
.gitignore | 3 +++
README.md | 14 ++++++++++++++
pyproject.toml | 12 ++++++++++++
tests/docs/.gitkeep | 0
tests/unit/.gitkeep | 0
5 files changed, 29 insertions(+)
create mode 100644 tests/docs/.gitkeep
create mode 100644 tests/unit/.gitkeep
diff --git a/.gitignore b/.gitignore
index eeb8a6ec4087..07992096c0fb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,4 @@
**/__pycache__
+
+# pytest cache
+/.pytest_cache/
diff --git a/README.md b/README.md
index 75229421763c..497ebb1de0f0 100644
--- a/README.md
+++ b/README.md
@@ -46,6 +46,20 @@ environment file or folder (generated via `bitbake -c rootfs_wicenv
- `src/wic/*`: core engine, plugins, and helpers.
- `src/bb/*`: various bitbake helpers that were brought along and used in other parts of wic.
- `src/oe/*`: various oe-core helpers that were brought along and used in other parts of wic.
+- `tests/*`: the standalone test suite and its documentation (see Testing below).
+
+## Testing
+
+wic ships a standalone test suite under `tests/` that runs from a plain
+checkout, with no bitbake and no OpenEmbedded build required. The test
+extras pull in everything the suite needs:
+
+```
+pip install -e ".[tests]"
+```
+
+See [tests/docs/](tests/docs/) for how to run the suite and the
+conventions it follows.
## Contributing
diff --git a/pyproject.toml b/pyproject.toml
index fdc1ce0f5ece..d660e39007c4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -21,6 +21,11 @@ classifiers = [
Homepage = "https://git.yoctoproject.org/wic"
Repository = "https://git.yoctoproject.org/wic"
+[project.optional-dependencies]
+tests = [
+ "pytest >= 7.0",
+]
+
[project.scripts]
wic = "wic.cli:main"
@@ -36,3 +41,10 @@ build-backend = "hatchling.build"
[tool.hatch.version]
path = "src/wic/cli.py"
+
+[tool.pytest.ini_options]
+# Keep a test's scratch directory only when it fails; a passing test's
+# tmp_path is removed automatically so repeated runs do not accumulate
+# leftover files under the pytest base temp directory.
+tmp_path_retention_policy = "failed"
+tmp_path_retention_count = 1
diff --git a/tests/docs/.gitkeep b/tests/docs/.gitkeep
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/tests/unit/.gitkeep b/tests/unit/.gitkeep
new file mode 100644
index 000000000000..e69de29bb2d1
--
2.50.0.173.g8b6f19ccfc3a
next prev parent reply other threads:[~2026-07-01 7:40 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 7:40 [wic][PATCH v3 00/10] tests: standalone test-suite framework plus the first unit test Trevor Woerner
2026-07-01 7:40 ` Trevor Woerner [this message]
2026-07-06 8:18 ` [yocto-patches] [wic][PATCH v3 01/10] tests: add the standalone test-suite skeleton Paul Barker
2026-07-01 7:40 ` [wic][PATCH v3 02/10] tests: add a session banner via conftest.py Trevor Woerner
2026-07-06 8:17 ` [yocto-patches] " Paul Barker
2026-07-01 7:40 ` [wic][PATCH v3 03/10] tests: add the run-tests.sh wrapper Trevor Woerner
2026-07-06 8:21 ` [yocto-patches] " Paul Barker
2026-07-01 7:40 ` [wic][PATCH v3 04/10] tests: add optional coverage reporting to run-tests.sh Trevor Woerner
2026-07-06 8:33 ` [yocto-patches] " Paul Barker
2026-07-01 7:40 ` [wic][PATCH v3 05/10] tests: add ruff linting " Trevor Woerner
2026-07-06 8:40 ` [yocto-patches] " Paul Barker
2026-07-01 7:40 ` [wic][PATCH v3 06/10] tests/docs: add the suite overview README Trevor Woerner
2026-07-06 8:47 ` [yocto-patches] " Paul Barker
2026-07-01 7:40 ` [wic][PATCH v3 07/10] tests/docs: add the test-authoring guide Trevor Woerner
2026-07-06 8:52 ` [yocto-patches] " Paul Barker
2026-07-01 7:40 ` [wic][PATCH v3 08/10] tests: ignore E402 in the test tree for the sys.path bootstrap Trevor Woerner
2026-07-06 8:55 ` [yocto-patches] " Paul Barker
2026-07-01 7:40 ` [wic][PATCH v3 09/10] tests/unit/test_bb_utils: test mkdirhier() and fix its missing errno import Trevor Woerner
2026-07-06 9:06 ` [yocto-patches] " Paul Barker
2026-07-01 7:40 ` [wic][PATCH v3 10/10] tests/docs: add the review rubric Trevor Woerner
2026-07-06 9:08 ` [yocto-patches] " Paul Barker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260701074030.1090807-2-twoerner@gmail.com \
--to=twoerner@gmail.com \
--cc=yocto-patches@lists.yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.