GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [PR #13685/12bde8af backport][8.4.x] Docs+Tests: clarify special discovery of pytest_generate_tests by patchback[bot] · Pull Request #13686 · pytest-dev/pytest

Conversation

@patchback

@patchback patchback Bot commented Aug 29, 2025

Copy link
Copy Markdown

This is a backport of PR #13685 as merged into main (12bde8a).

Summary
This PR improves the documentation and tests around the special discovery rules of pytest_generate_tests. Unlike most hooks (which must live in conftest.py or plugins), pytest_generate_tests is also discovered when defined directly inside test modules or classes. This PR clarifies that behavior in the docs and adds a minimal self-test that shows the difference.

Motivation
New users often get confused about where hooks should be placed. By explicitly pointing out that pytest_generate_tests is the only exception to the “hooks go in conftest/plugins” rule, we reduce misunderstandings and make the docs easier to follow.

Changes

  • Updated doc/en/how-to/writing_hook_functions.rst with a clear note on the exception for pytest_generate_tests.
  • Updated doc/en/how-to/parametrize.rst with a short reminder in the relevant section.
  • Added testing/test_pytest_generate_tests_discovery.py, which demonstrates that pytest_generate_tests inside a test module works, while pytest_terminal_summary does not.

Tests

  • Confirms pytest_generate_tests in a test module parametrizes correctly.
  • Confirms another hook (pytest_terminal_summary) inside a test module is ignored.

Docs
Only minimal “Note:” additions with cross-links, written for clarity and easy review.

Notes
No behavior changes — purely docs and tests. Pre-commit, mypy, and docs build all pass locally.

Related Issue
Closes #13577

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@The-Compiler @patchback
Merge pull request #13685 from CoretexShadow/fix/docs-pytest-generate…
b7f0568
…-tests

Docs+Tests: clarify special discovery of pytest_generate_tests

(cherry picked from commit 12bde8a)
@patchback patchback Bot mentioned this pull request Aug 29, 2025
Docs+Tests: clarify special discovery of pytest_generate_tests #13685
Merged
The-Compiler
The-Compiler approved these changes Aug 29, 2025
View reviewed changes
@The-Compiler
The-Compiler enabled auto-merge August 29, 2025 23:04
@The-Compiler
The-Compiler merged commit 975a60a into 8.4.x Aug 29, 2025
@The-Compiler
The-Compiler deleted the patchback/backports/8.4.x/12bde8af6dda3e7104f840209c199d151258b462/pr-13685 branch August 29, 2025 23:19
@rennerdo30 rennerdo30 mentioned this pull request Oct 21, 2026
[Historical PR] chore(deps-dev): update pytest requirement from >=7.0.0 to >=8.4.2 rennerdo30/pdf-translator#12
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@The-Compiler The-Compiler The-Compiler approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@The-Compiler
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.