8000 Fix typings, use pytest public APIs by tony · Pull Request #418 · vcs-python/libvcs · GitHub
[go: up one dir, main page]

Skip to content

Fix typings, use pytest public APIs #418

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 4 commits into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ $ pip install --user --upgrade --pre libvcs

- _Add your latest changes from PRs here_

## libvcs 0.16.5 (unreleased)

### Bug fixes

- Use pytest's public API when importing (#418)

## libvcs 0.16.4 (2022-09-18)

### Infrastructure
Expand Down
4 changes: 2 additions & 2 deletions src/libvcs/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

import pytest

from _pytest.doctest import DoctestItem


@pytest.fixture(autouse=True)
def add_doctest_fixtures(
request: pytest.FixtureRequest,
doctest_namespace: t.Dict[str, t.Any],
) -> None:
from _pytest.doctest import DoctestItem

if isinstance(request._pyfuncitem, DoctestItem):
request.getfixturevalue("add_doctest_fixtures")
request.getfixturevalue("set_home")
Expand Down
7 changes: 3 additions & 4 deletions src/libvcs/pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@

import pytest

from _pytest.doctest import DoctestItem
from _pytest.fixtures import SubRequest

from libvcs._internal.run import run
from libvcs.sync.git import GitRemote, GitSync
from libvcs.sync.hg import HgSync
Expand Down Expand Up @@ -410,7 +407,7 @@ def svn_repo(projects_path: pathlib.Path, svn_remote_repo: pathlib.Path) -> SvnS

@pytest.fixture
def add_doctest_fixtures(
request: SubRequest,
request: pytest.FixtureRequest,
doctest_namespace: dict[str, Any],
tmp_path: pathlib.Path,
set_home: pathlib.Path,
Expand All @@ -420,6 +417,8 @@ def add_doctest_fixtures(
create_hg_remote_repo: CreateProjectCallbackFixtureProtocol,
git_repo: pathlib.Path,
) -> None:
from _pytest.doctest import DoctestItem

if not isinstance(request._pyfuncitem, DoctestItem): # Only run on doctest items
return
doctest_namespace["tmp_path"] = tmp_path
Expand Down
4 changes: 1 addition & 3 deletions tests/test_pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

import pytest

import _pytest.pytester

from libvcs.pytest_plugin import CreateProjectCallbackFixtureProtocol


Expand Down Expand Up @@ -34,7 +32,7 @@ def test_create_svn_remote_repo(


def test_plugin(
pytester: _pytest.pytester.Pytester,
pytester: pytest.Pytester,
monkeypatch: pytest.MonkeyPatch,
) -> None:
# Initialize variables
Expand Down
0