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