From: Trevor Woerner <twoerner@gmail.com>
To: yocto-patches@lists.yoctoproject.org
Subject: [wic][PATCH v2 1/9] tests: add the standalone test-suite skeleton
Date: Tue, 30 Jun 2026 12:06:04 -0400 [thread overview]
Message-ID: <20260630160612.1005451-2-twoerner@gmail.com> (raw)
In-Reply-To: <20260630160612.1005451-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 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-06-30 16:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 16:06 [wic][PATCH v2 0/9] tests: standalone test-suite framework plus the first unit test Trevor Woerner
2026-06-30 16:06 ` Trevor Woerner [this message]
2026-06-30 16:06 ` [wic][PATCH v2 2/9] tests: add a session banner via conftest.py Trevor Woerner
2026-06-30 16:06 ` [wic][PATCH v2 3/9] tests: add the run-tests.sh wrapper Trevor Woerner
2026-06-30 16:06 ` [wic][PATCH v2 4/9] tests: add optional coverage reporting to run-tests.sh Trevor Woerner
2026-06-30 16:06 ` [wic][PATCH v2 5/9] tests: add ruff linting " Trevor Woerner
2026-06-30 16:06 ` [wic][PATCH v2 6/9] tests/docs: add the suite overview README Trevor Woerner
2026-06-30 16:06 ` [wic][PATCH v2 7/9] tests/docs: add the test-authoring guide Trevor Woerner
2026-06-30 16:06 ` [wic][PATCH v2 8/9] tests: ignore E402 in the test tree for the sys.path bootstrap Trevor Woerner
2026-06-30 16:06 ` [wic][PATCH v2 9/9] tests/unit/test_bb_utils: test mkdirhier() and fix its missing errno import Trevor Woerner
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=20260630160612.1005451-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox