Skip to content

Commit f548714

Browse files
committed
docs(_ext[sphinx_pytest_fixtures]): suppress generic resource usage snippets
why: def test_example(server: Server): ... is trivially obvious to any pytest user and adds nothing beyond the fixture signature. Override-hook and factory snippets are genuinely useful (conftest.py pattern and two-step instantiation pattern). what: - Return None for resource kind in _build_usage_snippet() instead of generating a generic test function snippet - Keep autouse note, factory snippet, and override-hook snippet
1 parent 2e4c02d commit f548714

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

docs/_ext/sphinx_pytest_fixtures.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -982,9 +982,10 @@ def _build_usage_snippet(
982982
" assert obj is not None\n"
983983
)
984984
else:
985-
sig_str = f"{fixture_name}: {ret_type}" if ret_type else fixture_name
986-
fn_keyword = "async def" if is_async else "def"
987-
code = f"{fn_keyword} test_example({sig_str}) -> None:\n ...\n"
985+
# Resource fixtures — generic snippet like
986+
# ``def test_example(server: Server): ...`` is trivially obvious
987+
# to any pytest user and adds nothing beyond the signature.
988+
return None
988989

989990
return nodes.literal_block(code, code, language="python")
990991

0 commit comments

Comments
 (0)