Make docstring style more consistent

This commit is contained in:
Ran Benita
2024-04-03 00:15:21 +03:00
parent e3b69d4f29
commit c01de1c73e
15 changed files with 64 additions and 71 deletions

View File

@@ -482,7 +482,7 @@ class TestTerminalReporting:
)
def test_logfinish_hook(self, pytester: pytest.Pytester) -> None:
"""Ensure the pytest_runtest_logfinish hook is being properly handled"""
"""Ensure the pytest_runtest_logfinish hook is being properly handled."""
pytester.makeconftest(
"""
def pytest_runtest_logfinish():
@@ -613,7 +613,7 @@ def test_fixture_teardown_failure(pytester: pytest.Pytester) -> None:
def test_config_initialization(
pytester: pytest.Pytester, monkeypatch: pytest.MonkeyPatch, pytestconfig
) -> None:
"""Ensure workers and controller are initialized consistently. Integration test for #445"""
"""Ensure workers and controller are initialized consistently. Integration test for #445."""
pytester.makepyfile(
**{
"dir_a/test_foo.py": """
@@ -637,7 +637,7 @@ def test_config_initialization(
@pytest.mark.parametrize("when", ["setup", "call", "teardown"])
def test_crashing_item(pytester, when) -> None:
"""Ensure crashing item is correctly reported during all testing stages"""
"""Ensure crashing item is correctly reported during all testing stages."""
code = dict(setup="", call="", teardown="")
code[when] = "os._exit(1)"
p = pytester.makepyfile(
@@ -770,7 +770,7 @@ def test_tmpdir_disabled(pytester: pytest.Pytester) -> None:
@pytest.mark.parametrize("plugin", ["xdist.looponfail"])
def test_sub_plugins_disabled(pytester, plugin) -> None:
"""Test that xdist doesn't break if we disable any of its sub-plugins. (#32)"""
"""Test that xdist doesn't break if we disable any of its sub-plugins (#32)."""
p1 = pytester.makepyfile(
"""
def test_ok():
@@ -800,9 +800,7 @@ class TestWarnings:
def test_warning_captured_deprecated_in_pytest_6(
self, pytester: pytest.Pytester
) -> None:
"""
Do not trigger the deprecated pytest_warning_captured hook in pytest 6+ (#562)
"""
"""Do not trigger the deprecated pytest_warning_captured hook in pytest 6+ (#562)."""
from _pytest import hookspec
if not hasattr(hookspec, "pytest_warning_captured"):
@@ -834,7 +832,7 @@ class TestWarnings:
@pytest.mark.parametrize("n", ["-n0", "-n1"])
def test_custom_subclass(self, pytester, n) -> None:
"""Check that warning subclasses that don't honor the args attribute don't break
pytest-xdist (#344)
pytest-xdist (#344).
"""
pytester.makepyfile(
"""
@@ -1117,7 +1115,7 @@ def test_error_report_styles(pytester, tb) -> None:
def test_color_yes_collection_on_non_atty(pytester, request) -> None:
"""skip collect progress report when working on non-terminals.
"""Skip collect progress report when working on non-terminals.
Similar to pytest-dev/pytest#1397
"""
@@ -1142,9 +1140,7 @@ def test_color_yes_collection_on_non_atty(pytester, request) -> None:
def test_without_terminal_plugin(pytester, request) -> None:
"""
No output when terminal plugin is disabled
"""
"""No output when terminal plugin is disabled."""
pytester.makepyfile(
"""
def test_1():
@@ -1158,9 +1154,7 @@ def test_without_terminal_plugin(pytester, request) -> None:
def test_internal_error_with_maxfail(pytester: pytest.Pytester) -> None:
"""
Internal error when using --maxfail option (#62, #65).
"""
"""Internal error when using --maxfail option (#62, #65)."""
pytester.makepyfile(
"""
import pytest
@@ -1181,9 +1175,7 @@ def test_internal_error_with_maxfail(pytester: pytest.Pytester) -> None:
def test_maxfail_causes_early_termination(pytester: pytest.Pytester) -> None:
"""
Ensure subsequent tests on a worker aren't run when using --maxfail (#1024).
"""
"""Ensure subsequent tests on a worker aren't run when using --maxfail (#1024)."""
pytester.makepyfile(
"""
def test1():

View File

@@ -14,9 +14,9 @@ class TestHooks:
)
def test_runtest_logreport(self, pytester: pytest.Pytester) -> None:
"""Test that log reports from pytest_runtest_logreport when running
with xdist contain "node", "nodeid", "worker_id", and "testrun_uid" attributes. (#8)
"""
"""Test that log reports from pytest_runtest_logreport when running with
xdist contain "node", "nodeid", "worker_id", and "testrun_uid"
attributes (#8)."""
pytester.makeconftest(
"""
def pytest_runtest_logreport(report):

View File

@@ -11,7 +11,7 @@ from xdist.workermanage import NodeManager
@pytest.fixture
def monkeypatch_3_cpus(monkeypatch: pytest.MonkeyPatch):
"""Make pytest-xdist believe the system has 3 CPUs"""
"""Make pytest-xdist believe the system has 3 CPUs."""
# block import
monkeypatch.setitem(sys.modules, "psutil", None) # type: ignore
monkeypatch.delattr(os, "sched_getaffinity", raising=False)

View File

@@ -350,8 +350,7 @@ class MyWarning(UserWarning):
],
)
def test_unserialize_warning_msg(w_cls):
"""Test that warning serialization process works well"""
"""Test that warning serialization process works well."""
# Create a test warning message
with pytest.warns(UserWarning) as w:
if not isinstance(w_cls, str):
@@ -392,8 +391,7 @@ class MyWarningUnknown(UserWarning):
def test_warning_serialization_tweaked_module():
"""Test for GH#404"""
"""Test for GH#404."""
# Create a test warning message
with pytest.warns(UserWarning) as w:
warnings.warn("hello", MyWarningUnknown)