Skip to content

Commit 58bac59

Browse files
Pierre-Sassoulasseifertm
authored andcommitted
[ruff] Add pydocstyle check (mostly autofix)
1 parent 60528d5 commit 58bac59

File tree

4 files changed

+32
-9
lines changed

4 files changed

+32
-9
lines changed

pyproject.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ write_to = "pytest_asyncio/_version.py"
6868

6969
[tool.ruff]
7070
line-length = 88
71+
format.docstring-code-format = true
7172
lint.select = [
7273
"B", # bugbear
74+
"D", # pydocstyle
7375
"E", # pycodestyle
7476
"F", # pyflakes
7577
"PGH004", # pygrep-hooks - Use specific rule codes when using noqa
@@ -80,9 +82,28 @@ lint.select = [
8082
"UP", # pyupgrade
8183
"W", # pycodestyle
8284
]
85+
8386
lint.ignore = [
8487
# bugbear ignore
8588
"B028", # No explicit `stacklevel` keyword argument found
89+
# pydocstyle ignore
90+
"D100", # Missing docstring in public module
91+
"D101", # Missing docstring in public class
92+
"D102", # Missing docstring in public method
93+
"D103", # Missing docstring in public function
94+
"D104", # Missing docstring in public package
95+
"D105", # Missing docstring in magic method
96+
"D106", # Missing docstring in public nested class
97+
"D107", # Missing docstring in `__init__`
98+
"D203", # `one-blank-line-before-class` (D203) and `no-blank-line-before-class` (D211) are incompatible
99+
"D205", # 1 blank line required between summary line and description
100+
"D209", # [*] Multi-line docstring closing quotes should be on a separate line
101+
"D212", # `multi-line-summary-first-line` (D212) and `multi-line-summary-second-line` (D213) are incompatible.
102+
"D400", # First line should end with a period
103+
"D401", # First line of docstring should be in imperative mood
104+
"D402", # First line should not be the function's signature
105+
"D404", # First word of the docstring should not be "This"
106+
"D415", # First line should end with a period, question mark, or exclamation point
86107
]
87108

88109
[tool.pytest.ini_options]

pytest_asyncio/plugin.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,7 @@ def _preprocess_async_fixtures(
266266

267267

268268
def _synchronize_async_fixture(fixturedef: FixtureDef) -> None:
269-
"""
270-
Wraps the fixture function of an async fixture in a synchronous function.
271-
"""
269+
"""Wraps the fixture function of an async fixture in a synchronous function."""
272270
if inspect.isasyncgenfunction(fixturedef.func):
273271
_wrap_asyncgen_fixture(fixturedef)
274272
elif inspect.iscoroutinefunction(fixturedef.func):
@@ -908,9 +906,10 @@ def pytest_pyfunc_call(pyfuncitem: Function) -> Optional[object]:
908906
def wrap_in_sync(
909907
func: Callable[..., Awaitable[Any]],
910908
):
911-
"""Return a sync wrapper around an async function executing it in the
912-
current event loop."""
913-
909+
"""
910+
Return a sync wrapper around an async function executing it in the
911+
current event loop.
912+
"""
914913
# if the function is already wrapped, we rewrap using the original one
915914
# not using __wrapped__ because the original function may already be
916915
# a wrapped one

tests/hypothesis/test_base.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
"""Tests for the Hypothesis integration, which wraps async functions in a
1+
"""
2+
Tests for the Hypothesis integration, which wraps async functions in a
23
sync shim for Hypothesis.
34
"""
45

tests/test_simple.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ class TestMarkerInClassBasedTests:
7575

7676
@pytest.mark.asyncio
7777
async def test_asyncio_marker_with_implicit_loop_fixture(self):
78-
"""Test the "asyncio" marker works on a method in
79-
a class-based test with implicit loop fixture."""
78+
"""
79+
Test the "asyncio" marker works on a method in
80+
a class-based test with implicit loop fixture.
81+
"""
8082
ret = await async_coro()
8183
assert ret == "ok"
8284

0 commit comments

Comments
 (0)