Skip to content

Commit cab0968

Browse files
Bastian-KrauseEmantor
authored andcommitted
doc/usage: restructure testing howto
Currently, the pytest plugin section lacks some structure: - Command-Line Options - Environment Variables - LG_ENV - LG_PROXY - Simple Example - Custom Fixture Example - Strategy Fixture Example - Feature Flags - Test Reports It's a mixture of tutorial-like examples, basic explanations and features. Move the examples into their own section and make their headlines more catchy. Signed-off-by: Bastian Krause <bst@pengutronix.de>
1 parent 3e09a79 commit cab0968

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

doc/usage.rst

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,12 @@ own proxy, and only fallback to LG_PROXY.
481481

482482
See also :ref:`overview-proxy-mechanism`.
483483

484-
Simple Example
485-
~~~~~~~~~~~~~~
486484

485+
Writing and Running Tests
486+
~~~~~~~~~~~~~~~~~~~~~~~~~
487+
488+
Getting Started: A Minimal Test
489+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
487490
As a minimal example, we have a target connected via a USB serial converter
488491
('/dev/ttyUSB0') and booted to the Linux shell.
489492
The following environment config file (``shell-example.yaml``) describes how to
@@ -559,8 +562,8 @@ environment config:
559562
560563
pytest has automatically found the test case and executed it on the target.
561564

562-
Custom Fixture Example
563-
~~~~~~~~~~~~~~~~~~~~~~
565+
Reusing Setup Code with Custom Fixtures
566+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
564567
When writing many test cases which use the same driver, we can get rid of some
565568
common code by wrapping the :any:`CommandProtocol` in a fixture.
566569
As pytest always executes the ``conftest.py`` file in the test suite directory,
@@ -597,8 +600,8 @@ With this fixture, we can simplify the ``test_example.py`` file to:
597600

598601
... 1 passed...
599602

600-
Strategy Fixture Example
601-
~~~~~~~~~~~~~~~~~~~~~~~~
603+
Managing Target States with Strategy Fixtures
604+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
602605
When using a :any:`Strategy` to transition the target between states, it is
603606
useful to define a function scope fixture per state in ``conftest.py``:
604607

0 commit comments

Comments
 (0)