@@ -1 +1,4 @@
**/__pycache__
+
+# pytest cache
+/.pytest_cache/
@@ -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
@@ -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
new file mode 100644
new file mode 100644
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