Skip to content

Commit f710f00

Browse files
committed
Update API reference with DEPENDS usage for pytest targets
1 parent 54588f8 commit f710f00

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

doc/api_reference.rst

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,28 @@ API Reference
153153
DEPENDS lib1 lib2
154154
)
155155

156+
The Python files containing :term:`Pytest` tests can also be explicitly
157+
set as dependencies, ensuring that the target rebuilds whenever these files
158+
are modified::
159+
160+
pytest_discover_tests(
161+
...
162+
DEPENDS
163+
/path/to/test_foo.py
164+
/path/to/test_bar.py
165+
)
166+
167+
For convenience, you can use the `GLOB_RECURSE
168+
<https://cmake.org/cmake/help/latest/command/file.html#glob-recurse>`_
169+
command to dynamically gather all test files::
170+
171+
file(GLOB_RECURSE test_files "/path/to/tests/*.py")
172+
173+
pytest_discover_tests(
174+
...
175+
DEPENDS ${test_files}
176+
)
177+
156178
* ``BUNDLE_TESTS``
157179

158180
Indicate whether Python tests should be bundled under a single

doc/release/release_notes.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44
Release Notes
55
*************
66

7+
.. release:: Upcoming
8+
9+
.. change:: changed
10+
11+
Updated the :ref:`api_reference` section to include details on how ``DEPENDS``
12+
can be used to ensure the target rebuilds whenever the Python files containing
13+
:term:`Pytest` tests are modified. Thanks :github_user:`AmeyaVSingh`!
14+
715
.. release:: 0.11.2
816
:date: 2025-01-18
917

0 commit comments

Comments
 (0)