Re: [yocto-patches] [wic][PATCH v3 03/10] tests: add the run-tests.sh wrapper

Paul Barker <[email protected]> Mon, 06 Jul 2026 09:21:24 +0100
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <[email protected]>
On Wed, 2026-07-01 at 03:40 -0400, Trevor Woerner via
lists.yoctoproject.org wrote:
> The suite is run with pytest, but invoking pytest directly has two
> sharp edges: it must be run from the right directory for the pyproject
> configuration to apply, and it happily runs against whatever Python
> happens to be first on PATH, even one that cannot import wic. A run
> against the wrong interpreter produces a misleading banner and, worse,
> can silently exercise a different wic than the one in the checkout.
> 
> This commit adds tests/run-tests.sh, a thin wrapper that removes both
> hazards:
> 
>   - it locates the repository root from its own path and changes there
>     before running, so it works regardless of the caller's directory;
> 
>   - it checks that the interpreter can import wic before handing off to
>     pytest, and fails loudly with the install command if it cannot;
> 
>   - with no arguments it runs the whole suite under tests/; any
>     argument it does not recognise (a path, -k EXPR, -v, ...) is passed
>     straight through to pytest, and an explicit -- forwards everything
>     after it.
> 
> The interpreter can be overridden with the PYTHON environment variable
> (default python3). -h/--help prints usage and exits.
> 
> The README Testing section gains the run-tests.sh invocation alongside
> the install step.
> 
> AI-Generated: codex/claude-opus 4.7 (xhigh)
> Signed-off-by: Trevor Woerner <[email protected]>

I don't think this is needed, since we already attempt to import wic in
conftest.py, we can call pytest.exit() from there if the import fails.

Best regards,

-- 
Paul Barker
signature.asc (application/pgp-signature, 252 B)
-----BEGIN PGP SIGNATURE-----

iIcEABYKAC8WIQSzjPXf5Y1BDWhU2iCrY1Tsnbr0bgUCaktlhBEccGF1bEBwYmFy
a2VyLmRldgAKCRCrY1Tsnbr0blHTAP9bHkU1/qDEljj1D3HBCRp08gcYFHbstAUV
Cy2zKUCVLgEAmuH//MJnvjCekLHwoUidViQk6bjhaIucniYTeOvGQgo=
=IK4e
-----END PGP SIGNATURE-----