mbox series

[0/5] RFC: Support pytest for bitbake self-tests

Message ID 20230616123651.915234-1-peter.hoyes@arm.com
Headers show
Series RFC: Support pytest for bitbake self-tests | expand

Message

Peter Hoyes June 16, 2023, 12:36 p.m. UTC
From: Peter Hoyes <Peter.Hoyes@arm.com>

pytest [1] is a test runner for Python test suites. Its advantages
over vanilla unittest are:

 * An existing tool with a familiar entry-point.
 * A flexible plugin architecture that supports a large plugin
   ecosystem, including for parallel testing and embedded testing.
 * Fixtures, for more flexible and granular sharing of setup/teardown
   logic.

This patch chain proposes introducing pytest as an alternative test
runner for the Bitbake self-tests.

pytest is mostly compatible with unittest TestCases out of the box,
but some small adaptations are included in this patch chain, alongside
a pytest.ini file and an update to the README.

This patch chain does not mandate how the pytest package is obtained,
apart from a reference to PyPI in the README. The 'minversion' is set
to 7.3, the latest version, in the pytest.ini file.

[1] https://docs.pytest.org/

Peter Hoyes (5):
  bitbake: tests/fetch: Mark TestTimeout as not a test suite
  bitbake: tests/fetch: Rename assertRaisesRegexp to assertRaisesRegex
  bitbake: tests/fetch: Set git config if not already set
  bitbake: tests: Use assertLogs to test logging output
  bitbake: Bootstrap pytest for self-tests

 bitbake/README                   |  8 ++++++--
 bitbake/lib/bb/tests/conftest.py |  8 ++++++++
 bitbake/lib/bb/tests/fetch.py    | 23 +++++++++++++++--------
 bitbake/lib/bb/tests/parse.py    | 16 +++++++++-------
 bitbake/pytest.ini               |  7 +++++++
 5 files changed, 45 insertions(+), 17 deletions(-)
 create mode 100644 bitbake/lib/bb/tests/conftest.py
 create mode 100644 bitbake/pytest.ini