Skip to content

feat: Add doc-pytest-plugin directive for pytest plugin docs#8

Merged
tony merged 7 commits into
mainfrom
doc-pytest-plugin-gp-sphinx
Apr 5, 2026
Merged

feat: Add doc-pytest-plugin directive for pytest plugin docs#8
tony merged 7 commits into
mainfrom
doc-pytest-plugin-gp-sphinx

Conversation

@tony
Copy link
Copy Markdown
Member

@tony tony commented Apr 5, 2026

Summary

Adds a higher-level doc-pytest-plugin directive to sphinx-autodoc-pytest-fixtures for building fixture-centric pytest plugin documentation pages.

What changed

  • adds the new doc-pytest-plugin directive and documents it in the package README and docs
  • makes generated autofixture content render correctly in both .rst and MyST Markdown pages
  • shares the MyST-safe rendering path between autofixtures and doc-pytest-plugin
  • adds integration coverage for Markdown-hosted plugin pages and autofixtures

Test plan

  • just ruff
  • just mypy
  • just test
  • just build-docs

@tony tony force-pushed the doc-pytest-plugin-gp-sphinx branch from 173ea3c to a2c98d4 Compare April 5, 2026 21:05
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 5, 2026

Codecov Report

❌ Patch coverage is 94.89796% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.59%. Comparing base (54ffa23) to head (4e6e1d6).

Files with missing lines Patch % Lines
.../src/sphinx_autodoc_pytest_fixtures/_directives.py 91.45% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #8      +/-   ##
==========================================
+ Coverage   88.42%   88.59%   +0.16%     
==========================================
  Files          71       71              
  Lines        6802     6955     +153     
==========================================
+ Hits         6015     6162     +147     
- Misses        787      793       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

why: Downstream projects need a reusable way to publish pytest plugin pages
with install guidance, autodetection notes, and generated fixture reference.
what:
- add doc-pytest-plugin to sphinx-autodoc-pytest-fixtures
- cover page/reference modes and no-fixture warnings in integration tests
- document the new helper in the package docs and README
@tony tony force-pushed the doc-pytest-plugin-gp-sphinx branch from a2c98d4 to cd48069 Compare April 5, 2026 21:07
tony added 6 commits April 5, 2026 17:03
…on_nodes

why: _build_doc_pytest_plugin_index_node was removed but the call site was not updated, crashing every docs build that uses doc-pytest-plugin.
what:
- Inline autofixture_index_node() construction with required ["module"] and ["exclude"] attributes
- No new imports needed; autofixture_index_node already imported at line 41
…ptions

why: mode: reference duplicates the manual recipe inside the helper, undermining the abstraction. :summary: multi-line values cause RST parse warnings. :project: is redundant when it equals 📦.
what:
- Remove mode from option_spec; intro block now always emits
- Make :summary: optional with guard in _build_page_intro_nodes
- Make :project: optional; empty string -> generic "test suite" link text (not package slug default)
- Fix docs demo from eval-rst + mode: reference to native MyST colon-fence
- Delete test_doc_pytest_plugin_reference_mode (tests removed behavior)
- Update class docstring
…st-plugin API

why: New optional :project: and :summary: options and removed :mode: need dedicated tests to prevent regressions.
what:
- test_doc_pytest_plugin_project_defaults_to_generic_link: :project: absent -> "test suite" generic text
- test_doc_pytest_plugin_summary_optional: no :summary: -> no empty <p>, page still renders
- test_doc_pytest_plugin_missing_package_fails_build: 📦 absent -> self.error() fires
why: Users need to know when to graduate from the directive to the manual recipe without discovering it by accident.
what:
- Add "When to use doc-pytest-plugin" section
- Add "Manual recipe (power path)" section with concrete example
…n eval-rst

why: Two categories of warning were failing docs CI under sphinx-build -W.

(1) _is_markdown_source checked the outer file's .md extension, returning
True even for directives inside {eval-rst} blocks. Those directives use a
docutils RST Body state whose nested_parse is pure RST — passing a
{eval-rst} backtick fence to it caused spurious "Inline literal
start-string without end-string" and "Unexpected indentation" warnings.
The correct check is whether the directive was invoked natively by MyST,
which is detectable via isinstance(directive.state, MockState).

(2) The demo page documented spf_demo_fixtures twice (autofixtures:: block
+ doc-pytest-plugin section) without :no-index: on either, triggering 9
"duplicate object description" warnings.

what:
- Replace _is_markdown_source with _is_native_myst (MockState isinstance
  check); eval-rst-embedded directives now skip the {eval-rst} wrap
- Add no_index parameter to _render_autofixtures_nodes to emit :no-index:
  on each generated autofixture directive when requested
- Add "no-index" flag option to AutofixturesDirective; pass it through to
  _render_autofixtures_nodes
- Add :no-index: to the demo autofixtures:: spf_demo_fixtures eval-rst
  block so doc-pytest-plugin remains the canonical fixture reference
- Document :no-index: option in the autofixtures options table
…est-fixtures

why: The CHANGES workspace package entry for sphinx-autodoc-pytest-fixtures
only described the initial release; the new doc-pytest-plugin directive
shipped on this branch needs a release note.
what:
- Add doc-pytest-plugin summary to sphinx-autodoc-pytest-fixtures entry
@tony tony merged commit 75136b9 into main Apr 5, 2026
14 checks passed
@tony tony deleted the doc-pytest-plugin-gp-sphinx branch April 5, 2026 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants