Skip to content

docs: link the current pytest-xdist newhooks.py from the hooks how-to#14503

Merged
nicoddemus merged 2 commits into
pytest-dev:mainfrom
golikovichev:docs/14465-xdist-newhooks-link
May 23, 2026
Merged

docs: link the current pytest-xdist newhooks.py from the hooks how-to#14503
nicoddemus merged 2 commits into
pytest-dev:mainfrom
golikovichev:docs/14465-xdist-newhooks-link

Conversation

@golikovichev
Copy link
Copy Markdown
Contributor

Summary

Closes #14465.

The how-to page for declaring new hooks points readers at newhooks.py in pytest-xdist as a real-world example, but the link is pinned to a 2017-era commit (974bd566) under the old xdist/ layout. xdist has since moved its hooks under src/xdist/, so following the link lands on an outdated snapshot rather than the file readers will see if they open the repository today.

This PR repoints the link at master/src/xdist/newhooks.py. The current file shows the same idea (declaring new hook specs) but matches what the project ships today, including the explicit @pytest.hookspec markers the issue mentioned.

I kept the PR narrow to the link change and a changelog entry, per the reporter's question in the issue. Happy to follow up with a separate PR if the maintainers want the how-to to also recommend @hookspec and @hookimpl more explicitly.

Test plan

  • Confirmed the new URL resolves: curl -I https://github.com/pytest-dev/pytest-xdist/blob/master/src/xdist/newhooks.py returns 200.
  • Confirmed the file at that URL is the current newhooks.py (top docstring reads "xdist hooks.").
  • Added changelog/14465.doc.rst per CONTRIBUTING.
  • Docs build not run locally (link-only change in .rst, no Sphinx directive added).

The "writing hook functions" how-to pointed at a frozen
974bd566 commit under xdist/newhooks.py, before the xdist layout
moved hooks into src/xdist/. Point the link at master/src so the
example tracks the project as it ships today, and add a doc
changelog entry.

Closes pytest-dev#14465.
@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided (automation) changelog entry is part of PR label May 23, 2026
Address maintainer feedback on the related issue: a release tag is
preferable to the moving master branch for the how-to link, because
the tag stays in sync with the version of pytest-xdist users actually
install via pip. master would drift the moment xdist refactors its
hook layout again.

Also reworded the changelog entry to match the new approach.

Targets pytest-xdist v3.8.0 (latest release as of 2025-07-01).
Copy link
Copy Markdown
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@nicoddemus nicoddemus merged commit f15e1a8 into pytest-dev:main May 23, 2026
33 checks passed
@golikovichev
Copy link
Copy Markdown
Contributor Author

Thanks for the quick review and merge. Glad the v3.8.0 tag pin was the right call.

@Pierre-Sassoulas Pierre-Sassoulas added this to the 9.1 milestone May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hooks how-to links to old xdist version

3 participants