Files
linux/Documentation/tools/unittest.rst
Mauro Carvalho Chehab 023aabb6cc docs: python: add helpers to run unit tests
While python internal libraries have support for unit tests, its
output is not nice. Add a helper module to improve its output.

I wrote this module last year while testing some scripts I used
internally. The initial skeleton was generated with the help of
LLM tools, but it was higly modified to ensure that it will work
as I would expect.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Message-ID: <37999041f616ddef41e84cf2686c0264d1a51dc9.1773074166.git.mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Message-ID: <d81be167b8cdeb003c1f8dcc7ad83a5ed2b520b6.1773770483.git.mchehab+huawei@kernel.org>
2026-03-22 15:02:29 -06:00

25 lines
726 B
ReStructuredText

.. SPDX-License-Identifier: GPL-2.0
===============
Python unittest
===============
Checking consistency of python modules can be complex. Sometimes, it is
useful to define a set of unit tests to help checking them.
While the actual test implementation is usecase dependent, Python already
provides a standard way to add unit tests by using ``import unittest``.
Using such class, requires setting up a test suite. Also, the default format
is a little bit ackward. To improve it and provide a more uniform way to
report errors, some unittest classes and functions are defined.
Unittest helper module
======================
.. automodule:: lib.python.unittest_helper
:members:
:show-inheritance:
:undoc-members: