8000 Fix typings, use pytest public APIs (#418) · vcs-python/libvcs@d7fc231 · GitHub
[go: up one dir, main page]

Skip to content

Commit d7fc231

Browse files
authored
Fix typings, use pytest public APIs (#418)
2 parents b0a86fa + 4812d74 commit d7fc231

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

CHANGES

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

1414
- _Add your latest changes from PRs here_
1515

16+
## libvcs 0.16.5 (unreleased)
17+
18+
### Bug fixes
19+
20+
- Use pytest's public API when importing (#418)
21+
1622
## libvcs 0.16.4 (2022-09-18)
1723

1824
### Infrastructure

src/libvcs/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
import pytest
55

6-
from _pytest.doctest import DoctestItem
7-
86

97
@pytest.fixture(autouse=True)
108
def add_doctest_fixtures(
119
request: pytest.FixtureRequest,
1210
doctest_namespace: t.Dict[str, t.Any],
1311
) -> None:
12+
from _pytest.doctest import DoctestItem
13+
1414
if isinstance(request._pyfuncitem, DoctestItem):
1515
request.getfixturevalue("add_doctest_fixtures")
1616
request.getfixturevalue("set_home")

src/libvcs/pytest_plugin.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99

1010
import pytest
1111

12-
from _pytest.doctest import DoctestItem
13-
from _pytest.fixtures import SubRequest
14-
1512
from libvcs._internal.run import run
1613
from libvcs.sync.git import GitRemote, GitSync
1714
from libvcs.sync.hg import HgSync
@@ -410,7 +407,7 @@ def svn_repo(projects_path: pathlib.Path, svn_remote_repo: pathlib.Path) -> SvnS
410407

411408
@pytest.fixture
412409
def add_doctest_fixtures(
413-
request: SubRequest,
410+
request: pytest.FixtureRequest,
414411
doctest_namespace: dict[str, Any],
415412
tmp_path: pathlib.Path,
416413
set_home: pathlib.Path,
@@ -420,6 +417,8 @@ def add_doctest_fixtures(
420417
create_hg_remote_repo: CreateProjectCallbackFixtureProtocol,
421418
git_repo: pathlib.Path,
422419
) -> None:
420+
from _pytest.doctest import DoctestItem
421+
423422
if not isinstance(request._pyfuncitem, DoctestItem): # Only run on doctest items
424423
return
425424
doctest_namespace["tmp_path"] = tmp_path

tests/test_pytest_plugin.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import pytest
66

7-
import _pytest.pytester
8-
97
from libvcs.pytest_plugin import CreateProjectCallbackFixtureProtocol
108

119

@@ -34,7 +32,7 @@ def test_create_svn_remote_repo(
3432

3533

3634
def test_plugin(
37-
pytester: _pytest.pytester.Pytester,
35+
pytester: pytest.Pytester,
3836
monkeypatch: pytest.MonkeyPatch,
3937
) -> None:
4038
# Initialize variables

0 commit comments

Comments
 (0)
0