Skip to content

Commit

Permalink
Add type annotations for test_session.py
Browse files Browse the repository at this point in the history
Also remove ignore check in mypy config and ignore some minor
pylint error
  • Loading branch information
Don Dang committed Mar 31, 2022
1 parent 9003a53 commit 64b39cb
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 20 deletions.
2 changes: 1 addition & 1 deletion aiven/client/argx.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
# cached_property only exists since python 3.8
SKIP_EVALUATION_TYPES = (property,)
if (sys.version_info[:2] >= (3, 8)) and hasattr(functools, "cached_property"):
SKIP_EVALUATION_TYPES += (functools.cached_property,)
SKIP_EVALUATION_TYPES += (functools.cached_property,) # pylint: disable=no-member

ARG_LIST_PROP = "_arg_list"
LOG_FORMAT = "%(levelname)s\t%(message)s"
Expand Down
2 changes: 1 addition & 1 deletion aiven/client/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def get_current_date() -> datetime:


if (sys.version_info.major, sys.version_info.minor) >= (3, 8):
from typing import Protocol
from typing import Protocol # pylint: disable=no-name-in-module

class ClientFactory(Protocol): # pylint: disable=too-few-public-methods
def __call__(self, base_url: str, show_http: bool, request_timeout: Optional[int]):
Expand Down
2 changes: 1 addition & 1 deletion aiven/client/pretty.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# string type checking must work on python 2.x and 3.x
try:
basestring
basestring # pylint: disable=used-before-assignment
except NameError:
basestring = str # pylint: disable=redefined-builtin

Expand Down
15 changes: 0 additions & 15 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,5 @@ ignore_errors = True
[mypy-aiven.client.cliarg]
warn_unused_ignores = False

[mypy-tests.__init__]
ignore_errors = True

[mypy-tests.test_argx]
ignore_errors = True

[mypy-tests.test_cli]
ignore_errors = True

[mypy-tests.test_cliarg]
ignore_errors = True

[mypy-tests.test_session]
ignore_errors = True

[mypy-version]
ignore_errors = True
4 changes: 2 additions & 2 deletions tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import pytest


def test_valid_requests_session():
def test_valid_requests_session() -> None:
"""Test that get_requests_session returns a valid Session that has the expected parameters set."""

session = get_requests_session()
Expand All @@ -31,7 +31,7 @@ def test_valid_requests_session():
("timeout", 0),
],
)
def test_adapter_parameters_are_passed_along(argument, value):
def test_adapter_parameters_are_passed_along(argument: str, value: int) -> None:
session = get_requests_session(**{argument: value})
adapter = session.adapters["https://"]
assert isinstance(adapter, AivenClientAdapter)
Expand Down

0 comments on commit 64b39cb

Please sign in to comment.