You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Clarifies that `pytest_generate_tests` is uniquely discovered when defined in test modules and classes, while other hooks must reside in `conftest.py` or plugins. Adds brief cross-links for readers and a tiny self-test to demonstrate the behavior.
3
+
4
+
Motivation
5
+
Users can be confused by hook discovery. This highlights the only exception to the “hooks live in conftest/plugins” rule and points to the relevant sections, reducing friction and support questions.
6
+
7
+
Changes
8
+
-`doc/en/how-to/writing_hook_functions.rst`: Add short note about `pytest_generate_tests` special discovery; link to parametrization docs and hook reference.
9
+
-`doc/en/how-to/parametrize.rst`: Add short note in the `pytest_generate_tests` section reinforcing the special discovery.
10
+
-`testing/test_pytest_generate_tests_discovery.py`: New pytester-based test showing `pytest_generate_tests` in a test module works, while `pytest_terminal_summary` in a test module is not executed.
11
+
12
+
Tests
13
+
- Verifies `pytest_generate_tests` in a test module parametrizes a test (2 passed).
14
+
- Verifies another hook (`pytest_terminal_summary`) in a test module is not executed.
15
+
16
+
Docs
17
+
Minimal “Note:” additions with cross-links, kept focused for easy review.
18
+
19
+
Notes
20
+
No behavior change; documentation and a small test only.
21
+
Local pre-commit and tests pass; docs build succeeds.
0 commit comments