File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 44Release 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
You can’t perform that action at this time.
0 commit comments