xref: /linux/Documentation/tools/unittest.rst (revision 5181afcdf99527dd92a88f80fc4d0d8013e1b510)
1*023aabb6SMauro Carvalho Chehab.. SPDX-License-Identifier: GPL-2.0
2*023aabb6SMauro Carvalho Chehab
3*023aabb6SMauro Carvalho Chehab===============
4*023aabb6SMauro Carvalho ChehabPython unittest
5*023aabb6SMauro Carvalho Chehab===============
6*023aabb6SMauro Carvalho Chehab
7*023aabb6SMauro Carvalho ChehabChecking consistency of python modules can be complex. Sometimes, it is
8*023aabb6SMauro Carvalho Chehabuseful to define a set of unit tests to help checking them.
9*023aabb6SMauro Carvalho Chehab
10*023aabb6SMauro Carvalho ChehabWhile the actual test implementation is usecase dependent, Python already
11*023aabb6SMauro Carvalho Chehabprovides a standard way to add unit tests by using ``import unittest``.
12*023aabb6SMauro Carvalho Chehab
13*023aabb6SMauro Carvalho ChehabUsing such class, requires setting up a test suite. Also, the default format
14*023aabb6SMauro Carvalho Chehabis a little bit ackward. To improve it and provide a more uniform way to
15*023aabb6SMauro Carvalho Chehabreport errors, some unittest classes and functions are defined.
16*023aabb6SMauro Carvalho Chehab
17*023aabb6SMauro Carvalho Chehab
18*023aabb6SMauro Carvalho ChehabUnittest helper module
19*023aabb6SMauro Carvalho Chehab======================
20*023aabb6SMauro Carvalho Chehab
21*023aabb6SMauro Carvalho Chehab.. automodule:: lib.python.unittest_helper
22*023aabb6SMauro Carvalho Chehab   :members:
23*023aabb6SMauro Carvalho Chehab   :show-inheritance:
24*023aabb6SMauro Carvalho Chehab   :undoc-members:
25