Re: [yocto-patches] [wic][PATCH v3 02/10] tests: add a session banner via conftest.py

Paul Barker <[email protected]> Mon, 06 Jul 2026 09:17:31 +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:
> When a test run starts it is useful to see, at a glance, exactly what
> is being tested: which host the run is on, which Python and pytest are
> in use, and -- most importantly -- which wic the suite imported and
> what version it reports. Without that, a passing or failing run is
> hard to attribute, especially when more than one wic checkout or
> virtualenv is in play.
> 
> pytest looks for a file named conftest.py and, among other things,
> calls its pytest_report_header() hook to print extra lines in the
> session header before collection begins. This commit adds that file
> with a single hook that prints a short banner:
> 
>   - the host node name, operating system, and machine type;
>   - the running Python version and the pytest version;
>   - the version wic reports and the filesystem path the wic module was
>     imported from.
> 
> The wic lookup is defensive: if wic cannot be imported (for example
> the test extras were not installed, or the suite is being run outside
> the checkout) the banner says so rather than aborting the run, so the
> failure is visible in the header instead of as an opaque collection
> error.
> 
> The file name conftest.py is mandatory; pytest discovers it by name,
> so it cannot be called anything else.
> 
> AI-Generated: codex/claude-opus 4.7 (xhigh)
> Signed-off-by: Trevor Woerner <[email protected]>

Claude is over-enthusiastic about writing explanations as usual - we
don't need to explain how conftest.py works. We don't need to explain an
obvious try/except around an import that may fail.

Othewise though, this looks good.

Reviewed-by: Paul Barker <[email protected]>

Best regards,

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

iIcEABYKAC8WIQSzjPXf5Y1BDWhU2iCrY1Tsnbr0bgUCaktkmxEccGF1bEBwYmFy
a2VyLmRldgAKCRCrY1Tsnbr0btkAAQCx0fTBVvvXS36AWkC1vYmz4tMFoQJnv2jn
poFuEfuVpAD+L0PC23zGzBkBfs1rGpwrZ8p5HW5Xz6hprx/STk9IrAs=
=GO2j
-----END PGP SIGNATURE-----