8000 fix(`pytest_plugin`): `Pytester` import, use public APIs from pytest by tony · Pull Request #442 · tmux-python/libtmux · GitHub
[go: up one dir, main page]

Skip to content

fix(pytest_plugin): Pytester import, use public APIs from pytest #442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Sep 22, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(test_common): Avoid reliance on internal pytest API for typing
  • Loading branch information
tony committed Sep 21, 2022
commit 69101f2c221cbf817f215ebbd7ff6b1bbbc77a5f
14 changes: 6 additions & 8 deletions tests/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

import pytest

from _pytest.monkeypatch import MonkeyPatch

import libtmux
from libtmux.common import (
TMUX_MAX_VERSION,
Expand All @@ -31,7 +29,7 @@
version_regex = re.compile(r"([0-9]\.[0-9])|(master)")


def test_allows_master_version(monkeypatch: MonkeyPatch) -> None:
def test_allows_master_version(monkeypatch: pytest.MonkeyPatch) -> None:
class Hi:
stdout = ["tmux master"]
stderr = None
Expand All @@ -49,7 +47,7 @@ def mock_tmux_cmd(*args: t.Any, **kwargs: t.Any) -> Hi:
), "Is the latest supported version with -master appended"


def test_allows_next_version(monkeypatch: MonkeyPatch) -> None:
def test_allows_next_version(monkeypatch: pytest.MonkeyPatch) -> None:
TMUX_NEXT_VERSION = str(float(TMUX_MAX_VERSION) + 0.1)

class Hi:
Expand All @@ -67,7 +65,7 @@ def mock_tmux_cmd(*args: t.Any, **kwargs: t.Any) -> Hi:
assert TMUX_NEXT_VERSION == get_version()


def test_get_version_openbsd(monkeypatch: MonkeyPatch) -> None:
def test_get_version_openbsd(monkeypatch: pytest.MonkeyPatch) -> None:
class Hi:
stderr = ["tmux: unknown option -- V"]

Expand All @@ -84,7 +82,7 @@ def mock_tmux_cmd(*args: t.Any, **kwargs: t.Any) -> Hi:
), "Is the latest supported version with -openbsd appended"


def test_get_version_too_low(monkeypatch: MonkeyPatch) -> None:
def test_get_version_too_low(monkeypatch: pytest.MonkeyPatch) -> None:
class Hi:
stderr = ["tmux: unknown option -- V"]

Expand All @@ -97,7 +95,7 @@ def mock_tmux_cmd(*args: t.Any, **kwargs: t.Any) -> Hi:
exc_info.match("is running tmux 1.3 or earlier")


def test_ignores_letter_versions(monkeypatch: MonkeyPatch) -> None:
def test_ignores_letter_versions(monkeypatch: pytest.MonkeyPatch) -> None:
"""Ignore letters such as 1.8b.

See ticket https://github.com/tmux-python/tmuxp/issues/55.
Expand All @@ -120,7 +118,7 @@ def test_ignores_letter_versions(monkeypatch: MonkeyPatch) -> None:
assert type(has_version("1.9a")) is bool


def test_error_version_less_1_7(monkeypatch: MonkeyPatch) -> None:
def test_error_version_less_1_7(monkeypatch: pytest.MonkeyPatch) -> None:
def mock_get_version() -> LooseVersion:
return LooseVersion("1.7")

Expand Down
0