From 5f6e5f6db6693df3f98c70c173796d8fad62b60a Mon Sep 17 00:00:00 2001 From: Igor Udot <47724762+horw@users.noreply.github.com> Date: Wed, 15 Jan 2025 18:57:15 +0800 Subject: [PATCH] Update docs/usages/markers.rst Co-authored-by: Fu Hanxi --- docs/usages/markers.rst | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/docs/usages/markers.rst b/docs/usages/markers.rst index bd709c1f..b88fddb0 100644 --- a/docs/usages/markers.rst +++ b/docs/usages/markers.rst @@ -20,48 +20,44 @@ The ``skip_if_soc`` marker simplifies this by allowing you to define conditions Examples ======== -Common Usage ------------- +Here are examples of how to use ``skip_if_soc`` with different conditions: -Here’s an example of how you can use ``skip_if_soc`` with different conditions: - -#. **Condition 1**. A boolean expression such as: ``SOC_ULP_SUPPORTED != 1 and SOC_UART_NUM != 3`` This skips tests for chips that: +**Condition 1**: A boolean expression such as ``SOC_ULP_SUPPORTED != 1 and SOC_UART_NUM != 3``. This skips tests for chips that: - Do not support the ``low power mode`` feature (``SOC_ULP_SUPPORTED != 1``). - - **And** have a UART number that is not equal to 3 (``SOC_UART_NUM != 3``). - -#. **Condition 2**. A boolean expression such as: ``SOC_ULP_SUPPORTED != 1 or SOC_UART_NUM != 3`` This skips tests for chips that: - - - Either do not support the ``low power mode`` feature (``SOC_ULP_SUPPORTED != 1``). - - **Or** have a UART number that is not equal to 3 (``SOC_UART_NUM != 3``). - -Replace ``{condition_xxx}`` and ``{targets}`` with your values. + - **And** have a UART number other than 3 (``SOC_UART_NUM != 3``). .. code:: python - @pytest.mark.skip_if_soc("{condition_one}") - @pytest.mark.parametrize("target", "{targets}", indirect=True) + @pytest.mark.skip_if_soc("SOC_ULP_SUPPORTED != 1 and SOC_UART_NUM != 3") + @pytest.mark.parametrize("target", ["esp32", "esp32s2", "esp32c3"], indirect=True) def test_template_first_condition(): pass +---- + +**Condition 2**: A boolean expression such as ``SOC_ULP_SUPPORTED != 1 or SOC_UART_NUM != 3``. This skips tests for chips that: - @pytest.mark.skip_if_soc("{condition_two}") - @pytest.mark.parametrize("target", "{targets}", indirect=True) + - Either do not support the ``low power mode`` feature (``SOC_ULP_SUPPORTED != 1``). + - **Or** have a UART number other than 3 (``SOC_UART_NUM != 3``). + +.. code:: python + + @pytest.mark.skip_if_soc("SOC_ULP_SUPPORTED != 1 or SOC_UART_NUM != 3") + @pytest.mark.parametrize("target", ["esp32", "esp32s2", "esp32c3"], indirect=True) def test_template_second_condition(): pass -Supported Targets ------------------ +---- -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. +**Condition 3**: You can use a shortcut to apply this condition to all ESP-IDF supported targets (assuming ``IDF_PATH`` is set). .. code:: python import pytest from esp_bool_parser.constants import SUPPORTED_TARGETS - - @pytest.mark.skip_if_soc("{condition}") + @pytest.mark.skip_if_soc("SOC_ULP_SUPPORTED != 1") @pytest.mark.parametrize("target", SUPPORTED_TARGETS, indirect=True) def test_template(): pass