summaryrefslogtreecommitdiffstats
path: root/documentation
diff options
context:
space:
mode:
authorMichael Opdenacker <michael.opdenacker@bootlin.com>2023-12-06 16:45:21 +0100
committerSteve Sakoman <steve@sakoman.com>2023-12-21 06:14:00 -1000
commit2ebcefae46a07c6a188d1ee6bbbaab7ff5c92e54 (patch)
tree3b6948207212d0913b0d384b53db91286aff3a85 /documentation
parent7640d1f82e26ab62ac10fe68db4a36595f1947c3 (diff)
downloadpoky-2ebcefae46a07c6a188d1ee6bbbaab7ff5c92e54.tar.gz
test-manual: add links to python unittest
Better than using "python unittest" without any special formatting. (From yocto-docs rev: 544cc1f950445d2c103c9adfa9147af1513b7a14) Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'documentation')
-rw-r--r--documentation/test-manual/intro.rst28
1 files changed, 16 insertions, 12 deletions
diff --git a/documentation/test-manual/intro.rst b/documentation/test-manual/intro.rst
index 51934f4851..811dfca4be 100644
--- a/documentation/test-manual/intro.rst
+++ b/documentation/test-manual/intro.rst
@@ -200,8 +200,8 @@ Tests map into the codebase as follows:
200 200
201 $ bitbake-selftest bb.tests.data.TestOverrides.test_one_override 201 $ bitbake-selftest bb.tests.data.TestOverrides.test_one_override
202 202
203 The tests are based on `Python 203 The tests are based on
204 unittest <https://docs.python.org/3/library/unittest.html>`__. 204 `Python unittest <https://docs.python.org/3/library/unittest.html>`__.
205 205
206- *oe-selftest:* 206- *oe-selftest:*
207 207
@@ -214,7 +214,8 @@ Tests map into the codebase as follows:
214 in the same thread. To parallelize large numbers of tests you can 214 in the same thread. To parallelize large numbers of tests you can
215 split the class into multiple units. 215 split the class into multiple units.
216 216
217 - The tests are based on Python unittest. 217 - The tests are based on
218 `Python unittest <https://docs.python.org/3/library/unittest.html>`__.
218 219
219 - The code for the tests resides in 220 - The code for the tests resides in
220 ``meta/lib/oeqa/selftest/cases/``. 221 ``meta/lib/oeqa/selftest/cases/``.
@@ -333,21 +334,24 @@ A simple test example from ``lib/bb/tests/data.py`` is::
333 val = self.d.expand("${foo}") 334 val = self.d.expand("${foo}")
334 self.assertEqual(str(val), "value_of_foo") 335 self.assertEqual(str(val), "value_of_foo")
335 336
336In this example, a ``DataExpansions`` class of tests is created, 337In this example, a ``DataExpansions`` class of tests is created, derived from
337derived from standard python unittest. The class has a common ``setUp`` 338standard `Python unittest <https://docs.python.org/3/library/unittest.html>`__.
338function which is shared by all the tests in the class. A simple test is 339The class has a common ``setUp`` function which is shared by all the tests in
339then added to test that when a variable is expanded, the correct value 340the class. A simple test is then added to test that when a variable is
340is found. 341expanded, the correct value is found.
341 342
342Bitbake selftests are straightforward python unittest. Refer to the 343BitBake selftests are straightforward
343Python unittest documentation for additional information on writing 344`Python unittest <https://docs.python.org/3/library/unittest.html>`__.
344these tests at: https://docs.python.org/3/library/unittest.html. 345Refer to the `Python unittest documentation
346<https://docs.python.org/3/library/unittest.html>`__ for additional information
347on writing such tests.
345 348
346``oe-selftest`` 349``oe-selftest``
347--------------- 350---------------
348 351
349These tests are more complex due to the setup required behind the scenes 352These tests are more complex due to the setup required behind the scenes
350for full builds. Rather than directly using Python's unittest, the code 353for full builds. Rather than directly using `Python unittest
354<https://docs.python.org/3/library/unittest.html>`__, the code
351wraps most of the standard objects. The tests can be simple, such as 355wraps most of the standard objects. The tests can be simple, such as
352testing a command from within the OE build environment using the 356testing a command from within the OE build environment using the
353following example:: 357following example::