Skip to content

Commit 5208a89

Browse files
horwhfudev
andauthored
Update docs/usages/markers.rst
Co-authored-by: Fu Hanxi <[email protected]>
1 parent f3dddd0 commit 5208a89

File tree

1 file changed

+20
-24
lines changed

1 file changed

+20
-24
lines changed

docs/usages/markers.rst

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -20,48 +20,44 @@ The ``skip_if_soc`` marker simplifies this by allowing you to define conditions
2020
Examples
2121
========
2222

23-
Common Usage
24-
------------
23+
Here are examples of how to use ``skip_if_soc`` with different conditions:
2524

26-
Here’s an example of how you can use ``skip_if_soc`` with different conditions:
25+
**Condition 1**: A boolean expression such as ``SOC_ULP_SUPPORTED != 1 and SOC_UART_NUM != 3``. This skips tests for chips that:
2726

28-
#. **Condition 1**. A boolean expression such as: ``SOC_ULP_SUPPORTED != 1 and SOC_UART_NUM != 3`` This skips tests for chips that:
29-
30-
- Do not support the ``low power mode`` feature (``SOC_ULP_SUPPORTED != 1``).
31-
- **And** have a UART number that is not equal to 3 (``SOC_UART_NUM != 3``).
32-
33-
#. **Condition 2**. A boolean expression such as: ``SOC_ULP_SUPPORTED != 1 or SOC_UART_NUM != 3`` This skips tests for chips that:
34-
35-
- Either do not support the ``low power mode`` feature (``SOC_ULP_SUPPORTED != 1``).
36-
- **Or** have a UART number that is not equal to 3 (``SOC_UART_NUM != 3``).
37-
38-
Replace ``{condition_xxx}`` and ``{targets}`` with your values.
27+
- Do not support the ``low power mode`` feature (``SOC_ULP_SUPPORTED != 1``).
28+
- **And** have a UART number other than 3 (``SOC_UART_NUM != 3``).
3929

4030
.. code:: python
4131
42-
@pytest.mark.skip_if_soc("{condition_one}")
43-
@pytest.mark.parametrize("target", "{targets}", indirect=True)
32+
@pytest.mark.skip_if_soc("SOC_ULP_SUPPORTED != 1 and SOC_UART_NUM != 3")
33+
@pytest.mark.parametrize("target", ["esp32", "esp32s2", "esp32c3"], indirect=True)
4434
def test_template_first_condition():
4535
pass
4636
37+
---
38+
39+
**Condition 2**: A boolean expression such as ``SOC_ULP_SUPPORTED != 1 or SOC_UART_NUM != 3``. This skips tests for chips that:
4740

48-
@pytest.mark.skip_if_soc("{condition_two}")
49-
@pytest.mark.parametrize("target", "{targets}", indirect=True)
41+
- Either do not support the ``low power mode`` feature (``SOC_ULP_SUPPORTED != 1``).
42+
- **Or** have a UART number other than 3 (``SOC_UART_NUM != 3``).
43+
44+
.. code:: python
45+
46+
@pytest.mark.skip_if_soc("SOC_ULP_SUPPORTED != 1 or SOC_UART_NUM != 3")
47+
@pytest.mark.parametrize("target", ["esp32", "esp32s2", "esp32c3"], indirect=True)
5048
def test_template_second_condition():
5149
pass
50+
51+
---
5252

53-
Supported Targets
54-
-----------------
55-
56-
The ``esp_bool_parser`` library provides the ``SUPPORTED_TARGETS`` constant, which contains a list of all supported chips. You can use this constant to dynamically filter targets based on your conditions.
53+
**Condition 3**: You can use a shortcut to apply this condition to all ESP-IDF supported targets (assuming ``IDF_PATH`` is set).
5754

5855
.. code:: python
5956
6057
import pytest
6158
from esp_bool_parser.constants import SUPPORTED_TARGETS
6259
63-
64-
@pytest.mark.skip_if_soc("{condition}")
60+
@pytest.mark.skip_if_soc("SOC_ULP_SUPPORTED != 1")
6561
@pytest.mark.parametrize("target", SUPPORTED_TARGETS, indirect=True)
6662
def test_template():
6763
pass

0 commit comments

Comments
 (0)