summaryrefslogtreecommitdiffstats
path: root/documentation
diff options
context:
space:
mode:
authorMichael Opdenacker <michael.opdenacker@bootlin.com>2023-12-06 16:45:21 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-12-18 13:18:55 +0000
commit98ee926e2c527cb9c3fd001cec8baefac6487774 (patch)
treef40e5237c03bac26772a21348df6075bfef6da44 /documentation
parent51c390571f32642333a910e7623b02d25ab5730f (diff)
downloadpoky-98ee926e2c527cb9c3fd001cec8baefac6487774.tar.gz
test-manual: add links to python unittest
Better than using "python unittest" without any special formatting. (From yocto-docs rev: ddf899611c56e6f44e9da2c69ed9c75a5491d882) Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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 e72a51172c..a2560f4f53 100644
--- a/documentation/test-manual/intro.rst
+++ b/documentation/test-manual/intro.rst
@@ -205,8 +205,8 @@ Tests map into the codebase as follows:
205 205
206 $ bitbake-selftest bb.tests.data.DataExpansions.test_one_var 206 $ bitbake-selftest bb.tests.data.DataExpansions.test_one_var
207 207
208 The tests are based on `Python 208 The tests are based on
209 unittest <https://docs.python.org/3/library/unittest.html>`__. 209 `Python unittest <https://docs.python.org/3/library/unittest.html>`__.
210 210
211- *oe-selftest:* 211- *oe-selftest:*
212 212
@@ -219,7 +219,8 @@ Tests map into the codebase as follows:
219 in the same thread. To parallelize large numbers of tests you can 219 in the same thread. To parallelize large numbers of tests you can
220 split the class into multiple units. 220 split the class into multiple units.
221 221
222 - The tests are based on Python unittest. 222 - The tests are based on
223 `Python unittest <https://docs.python.org/3/library/unittest.html>`__.
223 224
224 - The code for the tests resides in 225 - The code for the tests resides in
225 ``meta/lib/oeqa/selftest/cases/``. 226 ``meta/lib/oeqa/selftest/cases/``.
@@ -338,21 +339,24 @@ A simple test example from ``lib/bb/tests/data.py`` is::
338 val = self.d.expand("${foo}") 339 val = self.d.expand("${foo}")
339 self.assertEqual(str(val), "value_of_foo") 340 self.assertEqual(str(val), "value_of_foo")
340 341
341In this example, a ``DataExpansions`` class of tests is created, 342In this example, a ``DataExpansions`` class of tests is created, derived from
342derived from standard Python unittest. The class has a common ``setUp`` 343standard `Python unittest <https://docs.python.org/3/library/unittest.html>`__.
343function which is shared by all the tests in the class. A simple test is 344The class has a common ``setUp`` function which is shared by all the tests in
344then added to test that when a variable is expanded, the correct value 345the class. A simple test is then added to test that when a variable is
345is found. 346expanded, the correct value is found.
346 347
347BitBake selftests are straightforward Python unittest. Refer to the 348BitBake selftests are straightforward
348Python unittest documentation for additional information on writing 349`Python unittest <https://docs.python.org/3/library/unittest.html>`__.
349these tests at: https://docs.python.org/3/library/unittest.html. 350Refer to the `Python unittest documentation
351<https://docs.python.org/3/library/unittest.html>`__ for additional information
352on writing such tests.
350 353
351``oe-selftest`` 354``oe-selftest``
352--------------- 355---------------
353 356
354These tests are more complex due to the setup required behind the scenes 357These tests are more complex due to the setup required behind the scenes
355for full builds. Rather than directly using Python's unittest, the code 358for full builds. Rather than directly using `Python unittest
359<https://docs.python.org/3/library/unittest.html>`__, the code
356wraps most of the standard objects. The tests can be simple, such as 360wraps most of the standard objects. The tests can be simple, such as
357testing a command from within the OE build environment using the 361testing a command from within the OE build environment using the
358following example:: 362following example::