Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-doc
Path: blob/main/website/content/en/status/report-2022-10-2022-12/pytest-for-atf.adoc
18096 views
=== Pytest support for the FreeBSD testing framework

Links: +
link:https://reviews.freebsd.org/D31084[Initial review] URL: link:https://reviews.freebsd.org/D31084[https://reviews.freebsd.org/D31084] +
link:https://cgit.freebsd.org/src/tree/tests/examples/test_examples.py[Test examples] URL: link:https://cgit.freebsd.org/src/tree/tests/examples/test_examples.py[https://cgit.freebsd.org/src/tree/tests/examples/test_examples.py]

Contact: Alexander Chernikov <[email protected]>

Native pytest support for man:atf[7] enhances the capabilities of the FreeBSD test suite.

Pytest simplifies test writing by reducing the amount of boiler-plate code.
It offers several advantages over the existing atf-c and atf-shell bindings.
One of the most important ones is the test parametrization, which allows improving coverage with writing nearly no code.
The other is a rich assert system, offering detailed errors description.
Python man:atf[7] support comes with a number of libraries that abstract a number of commonly-used tasks.
For example, running a test within a VNET jail with man:epair[4] requires adding a single line of code.
Such helpers are especially handy in the networking area, where tests with complex VNET setups are not uncommon.

==== Current status

Python support has been committed to HEAD.
Currently, ~80 tests use the Python framework and the number is rising.
Example tests have been committed to show the handling of the typical cases.

==== Next steps

* Work on increasing the adoption of the framework
* Rewrite some of the older Python/shell tests in the netinet[6] to pytest (help is appreciated)