mirror of
https://git.yoctoproject.org/poky
synced 2026-09-15 06:49:33 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
51c390571f
commit
98ee926e2c
@@ -205,8 +205,8 @@ Tests map into the codebase as follows:
|
|||||||
|
|
||||||
$ bitbake-selftest bb.tests.data.DataExpansions.test_one_var
|
$ bitbake-selftest bb.tests.data.DataExpansions.test_one_var
|
||||||
|
|
||||||
The tests are based on `Python
|
The tests are based on
|
||||||
unittest <https://docs.python.org/3/library/unittest.html>`__.
|
`Python unittest <https://docs.python.org/3/library/unittest.html>`__.
|
||||||
|
|
||||||
- *oe-selftest:*
|
- *oe-selftest:*
|
||||||
|
|
||||||
@@ -219,7 +219,8 @@ Tests map into the codebase as follows:
|
|||||||
in the same thread. To parallelize large numbers of tests you can
|
in the same thread. To parallelize large numbers of tests you can
|
||||||
split the class into multiple units.
|
split the class into multiple units.
|
||||||
|
|
||||||
- The tests are based on Python unittest.
|
- The tests are based on
|
||||||
|
`Python unittest <https://docs.python.org/3/library/unittest.html>`__.
|
||||||
|
|
||||||
- The code for the tests resides in
|
- The code for the tests resides in
|
||||||
``meta/lib/oeqa/selftest/cases/``.
|
``meta/lib/oeqa/selftest/cases/``.
|
||||||
@@ -338,21 +339,24 @@ A simple test example from ``lib/bb/tests/data.py`` is::
|
|||||||
val = self.d.expand("${foo}")
|
val = self.d.expand("${foo}")
|
||||||
self.assertEqual(str(val), "value_of_foo")
|
self.assertEqual(str(val), "value_of_foo")
|
||||||
|
|
||||||
In this example, a ``DataExpansions`` class of tests is created,
|
In this example, a ``DataExpansions`` class of tests is created, derived from
|
||||||
derived from standard Python unittest. The class has a common ``setUp``
|
standard `Python unittest <https://docs.python.org/3/library/unittest.html>`__.
|
||||||
function which is shared by all the tests in the class. A simple test is
|
The class has a common ``setUp`` function which is shared by all the tests in
|
||||||
then added to test that when a variable is expanded, the correct value
|
the class. A simple test is then added to test that when a variable is
|
||||||
is found.
|
expanded, the correct value is found.
|
||||||
|
|
||||||
BitBake selftests are straightforward Python unittest. Refer to the
|
BitBake selftests are straightforward
|
||||||
Python unittest documentation for additional information on writing
|
`Python unittest <https://docs.python.org/3/library/unittest.html>`__.
|
||||||
these tests at: https://docs.python.org/3/library/unittest.html.
|
Refer to the `Python unittest documentation
|
||||||
|
<https://docs.python.org/3/library/unittest.html>`__ for additional information
|
||||||
|
on writing such tests.
|
||||||
|
|
||||||
``oe-selftest``
|
``oe-selftest``
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
These tests are more complex due to the setup required behind the scenes
|
These tests are more complex due to the setup required behind the scenes
|
||||||
for full builds. Rather than directly using Python's unittest, the code
|
for full builds. Rather than directly using `Python unittest
|
||||||
|
<https://docs.python.org/3/library/unittest.html>`__, the code
|
||||||
wraps most of the standard objects. The tests can be simple, such as
|
wraps most of the standard objects. The tests can be simple, such as
|
||||||
testing a command from within the OE build environment using the
|
testing a command from within the OE build environment using the
|
||||||
following example::
|
following example::
|
||||||
|
|||||||
Reference in New Issue
Block a user