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:18:23 -1000
commit5a7d73398497e8009f6513c003750e0061b0ad82 (patch)
tree8f7712fb71b5335b2099cfc8b06605386ba150fe /documentation
parentf04a8b052f73592c89d5ad5c7b1450adc6509fde (diff)
downloadpoky-5a7d73398497e8009f6513c003750e0061b0ad82.tar.gz
test-manual: add links to python unittest
Better than using "python unittest" without any special formatting. (From yocto-docs rev: b8771fb08b5efc7e6f2b4dbb5bd4df2bb1942ecf) 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 d14aa20f76..a76ae25609 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.TestOverrides.test_one_override 206 $ bitbake-selftest bb.tests.data.TestOverrides.test_one_override
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::