Skip to content

Commit

Permalink
Make things works on Python 3.5.2 again (#161)
Browse files Browse the repository at this point in the history
* Make things works on Python 3.5.2 again

Also add 3.5 testing to Travis to prevent future regressions.

Closes #159.

* Skip running mypy on Python 3.5.

* Only install flake8-mypy on Python 3.6+

On 3.5 it gives errors about not being able to find a suitable Python
interpreter, which breaks the Travis tests.
  • Loading branch information
bmerry authored and jettify committed Jan 8, 2019
1 parent 4a06de4 commit 1c942c0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ sudo: required


python:
- '3.5'
- '3.6'

install:
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ cov cover coverage: flake mypy checkrst
@echo "open file://`pwd`/htmlcov/index.html"

mypy:
mypy aiomonitor --ignore-missing-imports --disallow-untyped-calls --disallow-incomplete-defs --strict
if ! python --version | grep -q 'Python 3\.5\.'; then \
mypy aiomonitor --ignore-missing-imports --disallow-untyped-calls --disallow-incomplete-defs --strict; \
fi

ci: flake mypy
py.test -s -v --cov-report term --cov aiomonitor ./tests
Expand Down
7 changes: 5 additions & 2 deletions aiomonitor/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ def __enter__(self) -> 'Monitor':
self.start()
return self

def __exit__(self, exc_type: Optional[Type[BaseException]],
# exc_type should be Optional[Type[BaseException]], but
# this runs into https://github.com/python/typing/issues/266
# on Python 3.5.
def __exit__(self, exc_type: Any,
exc_value: Optional[BaseException],
traceback: Optional[TracebackType]) -> None:
self.close()
Expand Down Expand Up @@ -243,7 +246,7 @@ def map_args(self, cmd: Callable, args: Sequence[str]
for param in params:
if (param.annotation is param.empty or
not callable(param.annotation)):
type_: Callable[[Any], Any] = lambda x: x # noqa
type_ = lambda x: x # type: Callable[[Any], Any] # noqa
else:
type_ = param.annotation
try:
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ aiohttp==3.4.4
attrs==18.2.0
docutils==0.14
flake8-bugbear==18.8.0
flake8-mypy==17.8.0
flake8-mypy==17.8.0; python_version>='3.6'
flake8-quotes==1.0.0
flake8==3.5.0
ipdb==0.11
Expand Down

0 comments on commit 1c942c0

Please sign in to comment.