diff mbox series

[v2,01/12] ref-manual/classes.rst: document the ptest-python-pytest class and variables

Message ID 20250325-release-note-5-2-updates-v2-1-19f050d61da3@bootlin.com
State Accepted
Headers show
Series Updates for upcoming 5.2 release | expand

Commit Message

Antonin Godard March 25, 2025, 9:20 a.m. UTC
Add documentation for the ptest-python-pytest class, and the
PTEST_PYTEST_DIR variable which can be overriden.

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 documentation/ref-manual/classes.rst   | 15 +++++++++++++++
 documentation/ref-manual/variables.rst | 10 ++++++++++
 2 files changed, 25 insertions(+)

Comments

Quentin Schulz March 28, 2025, 1:58 p.m. UTC | #1
Hi Antonin,

On 3/25/25 10:20 AM, Antonin Godard via lists.yoctoproject.org wrote:
> Add documentation for the ptest-python-pytest class, and the
> PTEST_PYTEST_DIR variable which can be overriden.
> 
> Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
> ---
>   documentation/ref-manual/classes.rst   | 15 +++++++++++++++
>   documentation/ref-manual/variables.rst | 10 ++++++++++
>   2 files changed, 25 insertions(+)
> 
> diff --git a/documentation/ref-manual/classes.rst b/documentation/ref-manual/classes.rst
> index 6797927fe..8b930fe3d 100644
> --- a/documentation/ref-manual/classes.rst
> +++ b/documentation/ref-manual/classes.rst
> @@ -2707,6 +2707,21 @@ For information on setting up and running ptests, see the
>   ":ref:`test-manual/ptest:testing packages with ptest`"
>   section in the Yocto Project Development Tasks Manual.
>   
> +.. _ref-classes-ptest-python-pytest:
> +
> +``ptest-python-pytest``
> +=======================
> +
> +The :ref:`ref-classes-ptest-python-pytest` class can be used in Python-based

s/used/inherited/ ?

> +recipes to automatically configure the :ref:`ref-classes-ptest` class for Python
> +packages leveraging the `pytest <https://docs.pytest.org/>`__ unit test framework.
> +
> +Within the recipe, the :term:`PTEST_PYTEST_DIR` variable can be overridden to
> +specify the path to the directory containing the tests (default value:
> +``tests``). Test contained in this directory are installed in :term:`D` by the

"""
Within the recipe, the :term:`PTEST_PYTEST_DIR` variable specifies the 
path to the directory containing the tests that will be installed in 
:term:`D` by the [...].
"""

1) Try to avoid having a default in multiple locations in the docs, so 
we only need to change it in one place if it ever changes.
2) No need to say overridden, it's a variable, it's implied it can be 
overridden.

> +:ref:`ref-tasks-install_ptest_base` task, as well as a specific ``run-ptest``
> +script for this task.
> +
>   .. _ref-classes-python3-dir:
>   
>   ``python3-dir``
> diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
> index 41bda5d0d..8e0833bff 100644
> --- a/documentation/ref-manual/variables.rst
> +++ b/documentation/ref-manual/variables.rst
> @@ -7110,6 +7110,16 @@ system and gives an overview of their function and contents.
>         at build time should be done by adding "ptest" to (or removing it
>         from) :term:`DISTRO_FEATURES`.
>   
> +   :term:`PTEST_PYTEST_DIR`
> +      Within the :ref:`ref-classes-ptest-python-pytest` class, the
> +      :term:`PTEST_PYTEST_DIR` variable represents the path within the source
> +      tree of a Python package holding the unit tests to be tested with the

s/tested/run/ ?

Looks good otherwise.

Cheers,
Quentin
Antonin Godard April 3, 2025, 1:35 p.m. UTC | #2
Hi Quentin,

On Fri Mar 28, 2025 at 2:58 PM CET, Quentin Schulz wrote:
> Hi Antonin,
>
> On 3/25/25 10:20 AM, Antonin Godard via lists.yoctoproject.org wrote:
>> Add documentation for the ptest-python-pytest class, and the
>> PTEST_PYTEST_DIR variable which can be overriden.
>> 
>> Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
>> ---
>>   documentation/ref-manual/classes.rst   | 15 +++++++++++++++
>>   documentation/ref-manual/variables.rst | 10 ++++++++++
>>   2 files changed, 25 insertions(+)
>> 
>> diff --git a/documentation/ref-manual/classes.rst b/documentation/ref-manual/classes.rst
>> index 6797927fe..8b930fe3d 100644
>> --- a/documentation/ref-manual/classes.rst
>> +++ b/documentation/ref-manual/classes.rst
>> @@ -2707,6 +2707,21 @@ For information on setting up and running ptests, see the
>>   ":ref:`test-manual/ptest:testing packages with ptest`"
>>   section in the Yocto Project Development Tasks Manual.
>>   
>> +.. _ref-classes-ptest-python-pytest:
>> +
>> +``ptest-python-pytest``
>> +=======================
>> +
>> +The :ref:`ref-classes-ptest-python-pytest` class can be used in Python-based
>
> s/used/inherited/ ?
>
>> +recipes to automatically configure the :ref:`ref-classes-ptest` class for Python
>> +packages leveraging the `pytest <https://docs.pytest.org/>`__ unit test framework.
>> +
>> +Within the recipe, the :term:`PTEST_PYTEST_DIR` variable can be overridden to
>> +specify the path to the directory containing the tests (default value:
>> +``tests``). Test contained in this directory are installed in :term:`D` by the
>
> """
> Within the recipe, the :term:`PTEST_PYTEST_DIR` variable specifies the 
> path to the directory containing the tests that will be installed in 
> :term:`D` by the [...].
> """
>
> 1) Try to avoid having a default in multiple locations in the docs, so 
> we only need to change it in one place if it ever changes.

Right, I'll remove the default value, thanks.

> 2) No need to say overridden, it's a variable, it's implied it can be 
> overridden.

True, in this context, you can override it after inheriting the class. Some
variables are harder to override when they are assigned with the = operator,
especially for global classes.

Usually, I consider the ones assigned with ?= to be the "overrideable" ones. But
it's true that in this case, it's not super relevant.

>
>> +:ref:`ref-tasks-install_ptest_base` task, as well as a specific ``run-ptest``
>> +script for this task.
>> +
>>   .. _ref-classes-python3-dir:
>>   
>>   ``python3-dir``
>> diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
>> index 41bda5d0d..8e0833bff 100644
>> --- a/documentation/ref-manual/variables.rst
>> +++ b/documentation/ref-manual/variables.rst
>> @@ -7110,6 +7110,16 @@ system and gives an overview of their function and contents.
>>         at build time should be done by adding "ptest" to (or removing it
>>         from) :term:`DISTRO_FEATURES`.
>>   
>> +   :term:`PTEST_PYTEST_DIR`
>> +      Within the :ref:`ref-classes-ptest-python-pytest` class, the
>> +      :term:`PTEST_PYTEST_DIR` variable represents the path within the source
>> +      tree of a Python package holding the unit tests to be tested with the
>
> s/tested/run/ ?

Indeed!

> Looks good otherwise.

Thanks,
Antonin
diff mbox series

Patch

diff --git a/documentation/ref-manual/classes.rst b/documentation/ref-manual/classes.rst
index 6797927fe..8b930fe3d 100644
--- a/documentation/ref-manual/classes.rst
+++ b/documentation/ref-manual/classes.rst
@@ -2707,6 +2707,21 @@  For information on setting up and running ptests, see the
 ":ref:`test-manual/ptest:testing packages with ptest`"
 section in the Yocto Project Development Tasks Manual.
 
+.. _ref-classes-ptest-python-pytest:
+
+``ptest-python-pytest``
+=======================
+
+The :ref:`ref-classes-ptest-python-pytest` class can be used in Python-based
+recipes to automatically configure the :ref:`ref-classes-ptest` class for Python
+packages leveraging the `pytest <https://docs.pytest.org>`__ unit test framework.
+
+Within the recipe, the :term:`PTEST_PYTEST_DIR` variable can be overridden to
+specify the path to the directory containing the tests (default value:
+``tests``). Test contained in this directory are installed in :term:`D` by the
+:ref:`ref-tasks-install_ptest_base` task, as well as a specific ``run-ptest``
+script for this task.
+
 .. _ref-classes-python3-dir:
 
 ``python3-dir``
diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
index 41bda5d0d..8e0833bff 100644
--- a/documentation/ref-manual/variables.rst
+++ b/documentation/ref-manual/variables.rst
@@ -7110,6 +7110,16 @@  system and gives an overview of their function and contents.
       at build time should be done by adding "ptest" to (or removing it
       from) :term:`DISTRO_FEATURES`.
 
+   :term:`PTEST_PYTEST_DIR`
+      Within the :ref:`ref-classes-ptest-python-pytest` class, the
+      :term:`PTEST_PYTEST_DIR` variable represents the path within the source
+      tree of a Python package holding the unit tests to be tested with the
+      `pytest <https://docs.pytest.org>`__ framework. The default value for this
+      variable is ``tests``.
+
+      For more information, see
+      the :ref:`ref-classes-ptest-python-pytest` class documentation.
+
    :term:`PV`
       The version of the recipe. The version is normally extracted from the
       recipe filename. For example, if the recipe is named