Add flake8 to tox, disable qa on pyHS100/__init__.py, fix py27 compatibility (#31)

This commit is contained in:
Teemu R 2017-01-17 14:38:44 +01:00 committed by GadgetReactor
parent 2d6376b597
commit 5dc94cd5c8
3 changed files with 14 additions and 3 deletions

View File

@ -1,3 +1,4 @@
# flake8: noqa
from __future__ import absolute_import
from __future__ import unicode_literals
from pyHS100.pyHS100 import SmartBulb, SmartPlug, TPLinkSmartHomeProtocol, SmartPlugException

View File

@ -17,6 +17,7 @@ http://www.apache.org/licenses/LICENSE-2.0
# python2 compatibility
from __future__ import absolute_import
from __future__ import unicode_literals
from future.utils import raise_from
try:
basestring
except NameError:
@ -70,7 +71,7 @@ class SmartDevice(object):
request={target: {cmd: arg}}
)
except Exception as ex:
raise SmartPlugException(ex) from ex
raise_from(SmartPlugException(), ex)
if target not in response:
raise SmartPlugException("No required {} in response: {}".format(target, response))

13
tox.ini
View File

@ -1,13 +1,22 @@
[tox]
envlist=py27,py34,py35
envlist=py27,py34,py35,py36,flake8
[tox:travis]
2.7 = py27
3.4 = py34
3.5 = py35
3.6 = py36
[testenv]
deps=
future
pytest
voluptuous
commands=py.test
commands=py.test pyHS100
[testenv:flake8]
deps=flake8
commands=flake8 pyHS100
[flake8]
exclude = .git,.tox,__pycache__,pyHS100/tests/fakes.py