Skip to content

Commit 19a0b27

Browse files
committed
conftest: pydocstyle manual fixes
1 parent b9bdca6 commit 19a0b27

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

conftest.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
"""Conftest.py (root-level).
22
33
We keep this in root pytest fixtures in pytest's doctest plugin to be available, as well
4-
as avoiding conftest.py from being included in the wheel.
4+
as avoiding conftest.py from being included in the wheel, in addition to pytest_plugin
5+
for pytester only being available via the root directory.
6+
7+
See "pytest_plugins in non-top-level conftest files" in
8+
https://docs.pytest.org/en/stable/deprecations.html
59
"""
10+
611
import logging
712
import os
813
import pathlib
@@ -26,7 +31,7 @@
2631
@pytest.mark.skipif(not USING_ZSH, reason="Using ZSH")
2732
@pytest.fixture(autouse=USING_ZSH, scope="session")
2833
def zshrc(user_path: pathlib.Path) -> pathlib.Path:
29-
"""This quiets ZSH default message.
34+
"""Quiets ZSH default message.
3035
3136
Needs a startup file .zshenv, .zprofile, .zshrc, .zlogin.
3237
"""
@@ -37,11 +42,13 @@ def zshrc(user_path: pathlib.Path) -> pathlib.Path:
3742

3843
@pytest.fixture(autouse=True)
3944
def home_path_default(monkeypatch: pytest.MonkeyPatch, user_path: pathlib.Path) -> None:
45+
"""Set HOME to user_path (random, temporary directory)."""
4046
monkeypatch.setenv("HOME", str(user_path))
4147

4248

4349
@pytest.fixture
4450
def tmuxp_configdir(user_path: pathlib.Path) -> pathlib.Path:
51+
"""Ensure and return tmuxp config directory."""
4552
xdg_config_dir = user_path / ".config"
4653
xdg_config_dir.mkdir(exist_ok=True)
4754

@@ -54,12 +61,14 @@ def tmuxp_configdir(user_path: pathlib.Path) -> pathlib.Path:
5461
def tmuxp_configdir_default(
5562
monkeypatch: pytest.MonkeyPatch, tmuxp_configdir: pathlib.Path
5663
) -> None:
64+
"""Set tmuxp configuration directory for ``TMUXP_CONFIGDIR``."""
5765
monkeypatch.setenv("TMUXP_CONFIGDIR", str(tmuxp_configdir))
5866
assert get_workspace_dir() == str(tmuxp_configdir)
5967

6068

6169
@pytest.fixture(scope="function")
6270
def monkeypatch_plugin_test_packages(monkeypatch: pytest.MonkeyPatch) -> None:
71+
"""Monkeypatch tmuxp plugin fixtures to python path."""
6372
paths = [
6473
"tests/fixtures/pluginsystem/plugins/tmuxp_test_plugin_bwb/",
6574
"tests/fixtures/pluginsystem/plugins/tmuxp_test_plugin_bs/",
@@ -74,12 +83,14 @@ def monkeypatch_plugin_test_packages(monkeypatch: pytest.MonkeyPatch) -> None:
7483

7584
@pytest.fixture(scope="function")
7685
def session_params(session_params: t.Dict[str, t.Any]) -> t.Dict[str, t.Any]:
86+
"""Terminal-friendly tmuxp session_params for dimensions."""
7787
session_params.update({"x": 800, "y": 600})
7888
return session_params
7989

8090

8191
@pytest.fixture(scope="function")
8292
def socket_name(request: pytest.FixtureRequest) -> str:
93+
"""Random socket name for tmuxp."""
8394
return "tmuxp_test%s" % next(namer)
8495

8596

@@ -89,6 +100,7 @@ def add_doctest_fixtures(
89100
doctest_namespace: t.Dict[str, t.Any],
90101
tmp_path: pathlib.Path,
91102
) -> None:
103+
"""Harness pytest fixtures to doctests namespace."""
92104
if isinstance(request._pyfuncitem, DoctestItem) and shutil.which("tmux"):
93105
doctest_namespace["server"] = request.getfixturevalue("server")
94106
session: "Session" = request.getfixturevalue("session")

0 commit comments

Comments
 (0)