diff options
author | Michael Opdenacker <michael.opdenacker@bootlin.com> | 2023-12-06 16:45:21 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-12-18 13:18:55 +0000 |
commit | 98ee926e2c527cb9c3fd001cec8baefac6487774 (patch) | |
tree | f40e5237c03bac26772a21348df6075bfef6da44 /documentation | |
parent | 51c390571f32642333a910e7623b02d25ab5730f (diff) | |
download | poky-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.rst | 28 |
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 | ||
341 | In this example, a ``DataExpansions`` class of tests is created, | 342 | In this example, a ``DataExpansions`` class of tests is created, derived from |
342 | derived from standard Python unittest. The class has a common ``setUp`` | 343 | standard `Python unittest <https://docs.python.org/3/library/unittest.html>`__. |
343 | function which is shared by all the tests in the class. A simple test is | 344 | The class has a common ``setUp`` function which is shared by all the tests in |
344 | then added to test that when a variable is expanded, the correct value | 345 | the class. A simple test is then added to test that when a variable is |
345 | is found. | 346 | expanded, the correct value is found. |
346 | 347 | ||
347 | BitBake selftests are straightforward Python unittest. Refer to the | 348 | BitBake selftests are straightforward |
348 | Python unittest documentation for additional information on writing | 349 | `Python unittest <https://docs.python.org/3/library/unittest.html>`__. |
349 | these tests at: https://docs.python.org/3/library/unittest.html. | 350 | Refer to the `Python unittest documentation |
351 | <https://docs.python.org/3/library/unittest.html>`__ for additional information | ||
352 | on writing such tests. | ||
350 | 353 | ||
351 | ``oe-selftest`` | 354 | ``oe-selftest`` |
352 | --------------- | 355 | --------------- |
353 | 356 | ||
354 | These tests are more complex due to the setup required behind the scenes | 357 | These tests are more complex due to the setup required behind the scenes |
355 | for full builds. Rather than directly using Python's unittest, the code | 358 | for full builds. Rather than directly using `Python unittest |
359 | <https://docs.python.org/3/library/unittest.html>`__, the code | ||
356 | wraps most of the standard objects. The tests can be simple, such as | 360 | wraps most of the standard objects. The tests can be simple, such as |
357 | testing a command from within the OE build environment using the | 361 | testing a command from within the OE build environment using the |
358 | following example:: | 362 | following example:: |