Skip to content

Commit e16ea8f

Browse files
authored
fix(pytest_plugin): Use public pytest APIs, package conftest.py (#442)
Fixes (#441) Avoid using internal pytest APIs for typing: - [x] `_pytest.pytester.Pytester` -> `pytest.Pytester` - [x] `_pytest.monkeypatch.MonkeyPatcher` -> `pytest.MonkeyPatch` - [ ] `_pytest.doctest.DoctestItem` -> ??? (see pytest-dev/pytest#10312) - [x] add `conftest.py` to sdist
2 parents 9828540 + f4d5bfc commit e16ea8f

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

CHANGES

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@ $ pip install --user --upgrade --pre libtmux
1212

1313
- _Insert changes/features/fixes for next release here_
1414

15+
## libtmux 0.15.4 (unreleased)
16+
17+
### Bug fixes
18+
19+
- Use stable `pytest` API imports where possible to fix issues in downstream
20+
packaging on Arch (#441, via #442)
21+
22+
### Packaging
23+
24+
- Add `.tmuxp-before-script.sh` (used by `.tmuxp.yaml`) and `conftest.py` to
25+
source distributoins (#441, via #442)
26+
1527
## libtmux 0.15.3 (2022-09-20)
1628

1729
### Tests / docs

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,10 @@ packages = [
3333
include = [
3434
{ path = "CHANGES", format = "sdist" },
3535
{ path = ".tmuxp.yaml", format = "sdist" },
36+
{ path = ".tmuxp-before-script.sh", format = "sdist" },
3637
{ path = "tests", format = "sdist" },
3738
{ path = "docs", format = "sdist" },
39+
{ path = "conftest.py", format = "sdist" },
3840
]
3941

4042
[tool.poetry.urls]

tests/test_common.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
import pytest
1010

11-
from _pytest.monkeypatch import MonkeyPatch
12-
1311
import libtmux
1412
from libtmux.common import (
1513
TMUX_MAX_VERSION,
@@ -31,7 +29,7 @@
3129
version_regex = re.compile(r"([0-9]\.[0-9])|(master)")
3230

3331

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

5149

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

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

6967

70-
def test_get_version_openbsd(monkeypatch: MonkeyPatch) -> None:
68+
def test_get_version_openbsd(monkeypatch: pytest.MonkeyPatch) -> None:
7169
class Hi:
7270
stderr = ["tmux: unknown option -- V"]
7371

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

8684

87-
def test_get_version_too_low(monkeypatch: MonkeyPatch) -> None:
85+
def test_get_version_too_low(monkeypatch: pytest.MonkeyPatch) -> None:
8886
class Hi:
8987
stderr = ["tmux: unknown option -- V"]
9088

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

9997

100-
def test_ignores_letter_versions(monkeypatch: MonkeyPatch) -> None:
98+
def test_ignores_letter_versions(monkeypatch: pytest.MonkeyPatch) -> None:
10199
"""Ignore letters such as 1.8b.
102100
103101
See ticket https://github.com/tmux-python/tmuxp/issues/55.
@@ -120,7 +118,7 @@ def test_ignores_letter_versions(monkeypatch: MonkeyPatch) -> None:
120118
assert type(has_version("1.9a")) is bool
121119

122120

123-
def test_error_version_less_1_7(monkeypatch: MonkeyPatch) -> None:
121+
def test_error_version_less_1_7(monkeypatch: pytest.MonkeyPatch) -> None:
124122
def mock_get_version() -> LooseVersion:
125123
return LooseVersion("1.7")
126124

tests/test_pytest_plugin.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
import pytest
44

5-
import _pytest.pytester
6-
75

86
def test_plugin(
9-
pytester: _pytest.pytester.Pytester,
7+
pytester: pytest.Pytester,
108
monkeypatch: pytest.MonkeyPatch,
119
) -> None:
1210
# Initialize variables

0 commit comments

Comments
 (0)