Skip to content

Commit

Permalink
chore(ruff): ruff 0.5.3 fixes
Browse files Browse the repository at this point in the history
Fixed 13 errors:
- conftest.py:
    5 × PT001 (pytest-fixture-incorrect-parentheses-style)
- src/tmuxp/workspace/finders.py:
    2 × PLR6201 (literal-membership)
    2 × PLR1714 (repeated-equality-comparison)
- tests/workspace/conftest.py:
    1 × PT001 (pytest-fixture-incorrect-parentheses-style)
- tests/workspace/test_finder.py:
    3 × PT001 (pytest-fixture-incorrect-parentheses-style)

ruff check --select ALL . --fix --unsafe-fixes --preview --show-fixes --ignore T201 --ignore F401 --ignore PT014 --ignore RUF100; ruff format .
  • Loading branch information
tony committed Jul 21, 2024
1 parent e7f50ed commit a4b6c53
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
10 changes: 5 additions & 5 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def home_path_default(monkeypatch: pytest.MonkeyPatch, user_path: pathlib.Path)
monkeypatch.setenv("HOME", str(user_path))


@pytest.fixture()
@pytest.fixture
def tmuxp_configdir(user_path: pathlib.Path) -> pathlib.Path:
"""Ensure and return tmuxp config directory."""
xdg_config_dir = user_path / ".config"
Expand All @@ -58,7 +58,7 @@ def tmuxp_configdir(user_path: pathlib.Path) -> pathlib.Path:
return tmuxp_configdir


@pytest.fixture()
@pytest.fixture
def tmuxp_configdir_default(
monkeypatch: pytest.MonkeyPatch,
tmuxp_configdir: pathlib.Path,
Expand All @@ -68,7 +68,7 @@ def tmuxp_configdir_default(
assert get_workspace_dir() == str(tmuxp_configdir)


@pytest.fixture()
@pytest.fixture
def monkeypatch_plugin_test_packages(monkeypatch: pytest.MonkeyPatch) -> None:
"""Monkeypatch tmuxp plugin fixtures to python path."""
paths = [
Expand All @@ -83,14 +83,14 @@ def monkeypatch_plugin_test_packages(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.syspath_prepend(str(pathlib.Path(path).resolve()))


@pytest.fixture()
@pytest.fixture
def session_params(session_params: t.Dict[str, t.Any]) -> t.Dict[str, t.Any]:
"""Terminal-friendly tmuxp session_params for dimensions."""
session_params.update({"x": 800, "y": 600})
return session_params


@pytest.fixture()
@pytest.fixture
def socket_name(request: pytest.FixtureRequest) -> str:
"""Random socket name for tmuxp."""
return f"tmuxp_test{next(namer)}"
Expand Down
7 changes: 2 additions & 5 deletions src/tmuxp/workspace/finders.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,7 @@ def find_workspace_file(
elif (
not isabs(workspace_file)
or len(dirname(workspace_file)) > 1
or workspace_file == "."
or workspace_file == ""
or workspace_file == "./"
or workspace_file in {".", "", "./"}
): # if relative, fill in full path
workspace_file = normpath(join(cwd, workspace_file))

Expand Down Expand Up @@ -247,6 +245,5 @@ def is_pure_name(path: str) -> bool:
not os.path.isabs(path)
and len(os.path.dirname(path)) == 0
and not os.path.splitext(path)[1]
and path != "."
and path != ""
and path not in {".", ""}
)
2 changes: 1 addition & 1 deletion tests/workspace/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from tests.fixtures.structures import WorkspaceTestData


@pytest.fixture()
@pytest.fixture
def config_fixture() -> WorkspaceTestData:
"""Deferred import of tmuxp.tests.fixtures.*.
Expand Down
6 changes: 3 additions & 3 deletions tests/workspace/test_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,23 +104,23 @@ def test_tmuxp_configdir_xdg_config_dir(
assert get_workspace_dir() == str(tmux_dir)


@pytest.fixture()
@pytest.fixture
def homedir(tmp_path: pathlib.Path) -> pathlib.Path:
"""Fixture to ensure and return a home directory."""
home = tmp_path / "home"
home.mkdir()
return home


@pytest.fixture()
@pytest.fixture
def configdir(homedir: pathlib.Path) -> pathlib.Path:
"""Fixture to ensure user directory for tmuxp and return it, via homedir fixture."""
conf = homedir / ".tmuxp"
conf.mkdir()
return conf


@pytest.fixture()
@pytest.fixture
def projectdir(homedir: pathlib.Path) -> pathlib.Path:
"""Fixture to ensure and return an example project dir."""
proj = homedir / "work" / "project"
Expand Down

0 comments on commit a4b6c53

Please sign in to comment.