-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use pytest-httpx * Fix Python 3.7 * Fix AsyncMockMixin warning * Fix warnings * Update httpx requirement from <0.17,>=0.14 to >=0.14,<0.18 Updates the requirements on [httpx](https://github.com/encode/httpx) to permit the latest version. - [Release notes](https://github.com/encode/httpx/releases) - [Changelog](https://github.com/encode/httpx/blob/master/CHANGELOG.md) - [Commits](encode/httpx@0.14.0...0.17.0) Signed-off-by: dependabot[bot] <[email protected]> * use scm_version * Update httpx requirement from <0.18,>=0.14 to >=0.14,<0.19 Updates the requirements on [httpx](https://github.com/encode/httpx) to permit the latest version. - [Release notes](https://github.com/encode/httpx/releases) - [Changelog](https://github.com/encode/httpx/blob/master/CHANGELOG.md) - [Commits](encode/httpx@0.14.0...0.18.0) Signed-off-by: dependabot[bot] <[email protected]> * Adapt to updated pytest-httpx * Update test requirements * Update httpx requirement from <0.19,>=0.14 to >=0.14,<0.20 (#42) * Update httpx requirement from <0.19,>=0.14 to >=0.14,<0.20 Updates the requirements on [httpx](https://github.com/encode/httpx) to permit the latest version. - [Release notes](https://github.com/encode/httpx/releases) - [Changelog](https://github.com/encode/httpx/blob/master/CHANGELOG.md) - [Commits](encode/httpx@0.14.0...0.19.0) --- updated-dependencies: - dependency-name: httpx dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> * Fix mypy Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Guido Schmitz <[email protected]> * Update changelog * Add revs * Fix pacakge name Co-authored-by: Markus Bong <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Markus Bong <[email protected]>
- Loading branch information
1 parent
9d875d1
commit 44a1af1
Showing
17 changed files
with
204 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/mirrors-yapf | ||
rev: '' | ||
rev: 'v0.31.0' | ||
hooks: | ||
- id: yapf | ||
- repo: https://github.com/pycqa/isort | ||
rev: '' | ||
rev: '5.9.3' | ||
hooks: | ||
- id: isort | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: '' | ||
rev: 'v4.0.1' | ||
hooks: | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,10 @@ | ||
__version__ = "0.5.1" | ||
try: | ||
from importlib.metadata import PackageNotFoundError, version | ||
except ImportError: | ||
from importlib_metadata import PackageNotFoundError, version # type: ignore[no-redef] | ||
|
||
try: | ||
__version__ = version("devolo_plc_api") | ||
except PackageNotFoundError: | ||
# package is not installed - e.g. pulled and run locally | ||
__version__ = "0.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,6 @@ | |
from setuptools import find_packages, setup | ||
from setuptools.command.develop import develop | ||
|
||
from devolo_plc_api import __version__ | ||
|
||
with open("README.md", "r") as fh: | ||
long_description = fh.read() | ||
|
||
|
@@ -24,7 +22,7 @@ def run(self): | |
|
||
setup( | ||
name="devolo_plc_api", | ||
version=__version__, | ||
use_scm_version=True, | ||
author="Markus Bong, Guido Schmitz", | ||
author_email="[email protected], [email protected]", | ||
description="devolo PLC devices in Python", | ||
|
@@ -39,7 +37,8 @@ def run(self): | |
"Operating System :: OS Independent", | ||
], | ||
install_requires=[ | ||
"httpx>=0.14,<0.17", | ||
"httpx>=0.14,<0.20", | ||
"importlib-metadata;python_version<'3.8'", | ||
"protobuf", | ||
"zeroconf>=0.27.0", | ||
], | ||
|
@@ -52,8 +51,10 @@ def run(self): | |
"pytest", | ||
"pytest-asyncio", | ||
"pytest-cov", | ||
"pytest-httpx>=0.12", | ||
"pytest-mock", | ||
], | ||
}, | ||
setup_requires=["setuptools_scm"], | ||
python_requires='>=3.7', | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,29 @@ | ||
import pytest | ||
from httpx import ConnectTimeout | ||
|
||
try: | ||
from unittest.mock import AsyncMock | ||
except ImportError: | ||
from asynctest import CoroutineMock as AsyncMock | ||
|
||
from ..stubs.protobuf import StubProtobuf | ||
|
||
|
||
@pytest.fixture() | ||
def mock_protobuf(): | ||
return StubProtobuf() | ||
async def mock_protobuf(): | ||
protobuf = StubProtobuf() | ||
yield protobuf | ||
await protobuf._session.aclose() | ||
|
||
|
||
@pytest.fixture() | ||
def mock_get(mocker): | ||
mocker.patch("httpx.AsyncClient.get", new=AsyncMock()) | ||
def mock_device_unavailable(httpx_mock): | ||
|
||
def raise_type_error(request, extensions): | ||
raise ConnectTimeout(request=request, message=extensions) | ||
|
||
@pytest.fixture() | ||
def mock_post(mocker): | ||
mocker.patch("httpx.AsyncClient.post", new=AsyncMock()) | ||
httpx_mock.add_callback(raise_type_error) | ||
|
||
|
||
@pytest.fixture() | ||
def mock_device_unavailable(mocker): | ||
mocker.patch("httpx.AsyncClient.get", side_effect=ConnectTimeout(message="", request="")) | ||
mocker.patch("httpx.AsyncClient.post", side_effect=ConnectTimeout(message="", request="")) | ||
def mock_wrong_password(httpx_mock): | ||
|
||
def raise_type_error(request, extensions): | ||
raise TypeError | ||
|
||
@pytest.fixture() | ||
def mock_wrong_password(mocker): | ||
mocker.patch("httpx.AsyncClient.get", side_effect=TypeError()) | ||
mocker.patch("httpx.AsyncClient.post", side_effect=TypeError()) | ||
httpx_mock.add_callback(raise_type_error) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.