Refactor & add unittests for almost all functionality, add tox for running tests on py27 and py35 (#17)
* Refactor & add unittests for almost all functionality, add tox for running tests on py27 and py35
This commit adds unit tests for current api functionality.
- currently no mocking, all tests are run on the device.
- the library is now compatible with python 2.7 and python 3.5, use tox for tests
- schema checks are done with voluptuous
refactoring:
- protocol is separated into its own file, smartplug adapted to receive protocol worker as parameter.
- cleaned up the initialization routine, initialization is done on use, not on creation of smartplug
- added model and features properties, identity kept for backwards compatibility
- no more storing of local variables outside _sys_info, paves a way to handle state changes sanely (without complete reinitialization)
* Fix CI warnings, remove unused leftover code
* Rename _initialize to _fetch_sysinfo, as that's what it does.
* examples.cli: fix identify call, prettyprint sysinfo, update readme which had false format for led setting
* Add tox-travis for automated testing.
2016-12-16 22:51:56 +00:00
|
|
|
[tox]
|
2020-03-18 11:50:42 +00:00
|
|
|
envlist=py37,py38,flake8,linting,typing
|
2017-10-07 15:44:45 +00:00
|
|
|
skip_missing_interpreters = True
|
Refactor & add unittests for almost all functionality, add tox for running tests on py27 and py35 (#17)
* Refactor & add unittests for almost all functionality, add tox for running tests on py27 and py35
This commit adds unit tests for current api functionality.
- currently no mocking, all tests are run on the device.
- the library is now compatible with python 2.7 and python 3.5, use tox for tests
- schema checks are done with voluptuous
refactoring:
- protocol is separated into its own file, smartplug adapted to receive protocol worker as parameter.
- cleaned up the initialization routine, initialization is done on use, not on creation of smartplug
- added model and features properties, identity kept for backwards compatibility
- no more storing of local variables outside _sys_info, paves a way to handle state changes sanely (without complete reinitialization)
* Fix CI warnings, remove unused leftover code
* Rename _initialize to _fetch_sysinfo, as that's what it does.
* examples.cli: fix identify call, prettyprint sysinfo, update readme which had false format for led setting
* Add tox-travis for automated testing.
2016-12-16 22:51:56 +00:00
|
|
|
|
|
|
|
[tox:travis]
|
2018-08-13 18:37:43 +00:00
|
|
|
3.7 = py37
|
2020-03-18 11:50:42 +00:00
|
|
|
3.8 = py38
|
2017-01-17 13:38:44 +00:00
|
|
|
|
Refactor & add unittests for almost all functionality, add tox for running tests on py27 and py35 (#17)
* Refactor & add unittests for almost all functionality, add tox for running tests on py27 and py35
This commit adds unit tests for current api functionality.
- currently no mocking, all tests are run on the device.
- the library is now compatible with python 2.7 and python 3.5, use tox for tests
- schema checks are done with voluptuous
refactoring:
- protocol is separated into its own file, smartplug adapted to receive protocol worker as parameter.
- cleaned up the initialization routine, initialization is done on use, not on creation of smartplug
- added model and features properties, identity kept for backwards compatibility
- no more storing of local variables outside _sys_info, paves a way to handle state changes sanely (without complete reinitialization)
* Fix CI warnings, remove unused leftover code
* Rename _initialize to _fetch_sysinfo, as that's what it does.
* examples.cli: fix identify call, prettyprint sysinfo, update readme which had false format for led setting
* Add tox-travis for automated testing.
2016-12-16 22:51:56 +00:00
|
|
|
[testenv]
|
2017-08-09 11:07:24 +00:00
|
|
|
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
|
2020-04-20 17:26:20 +00:00
|
|
|
deps = -r{toxinidir}/requirements_test.txt
|
2017-08-09 11:07:24 +00:00
|
|
|
commands=
|
async++, small powerstrip improvements (#46)
* async++, small powerstrip improvements
* use asyncclick instead of click, allows defining the commands with async def to avoid manual eventloop/asyncio.run handling
* improve powerstrip support:
* new powerstrip api: turn_{on,off}_by_{name,index} methods
* cli: fix on/off for powerstrip using the new apis
* add missing update()s for cli's hsv, led, temperature (fixes #43)
* prettyprint the received payloads when debug mode in use
* cli: debug mode can be activated now with '-d'
* update requirements_test.txt
* remove outdated click-datetime, replace click with asyncclick
* debug is a flag
* make smartstripplug to inherit the sysinfo from its parent, allows for simple access of general plug properties
* proper bound checking for index accesses, allow controlling the plug at index 0
* remove the mess of turn_{on,off}_by_{name,index}, get_plug_by_{name,index} are enough.
* adapt cli to use that
* allow changing the alias per index
* use f-strings consistently everywhere in the cli
* add tests for get_plug_by_{index,name}
2020-04-21 18:46:13 +00:00
|
|
|
pytest --cov --cov-config=tox.ini kasa
|
2017-01-17 13:38:44 +00:00
|
|
|
|
|
|
|
[testenv:flake8]
|
2019-11-11 21:14:34 +00:00
|
|
|
deps=
|
|
|
|
flake8
|
|
|
|
flake8-docstrings
|
2019-12-18 08:11:18 +00:00
|
|
|
commands=flake8 kasa
|
2017-01-17 13:38:44 +00:00
|
|
|
|
2017-09-18 16:13:06 +00:00
|
|
|
[testenv:typing]
|
2019-11-11 21:14:34 +00:00
|
|
|
skip_install=true
|
2017-09-18 16:13:06 +00:00
|
|
|
deps=mypy
|
2019-12-18 08:11:18 +00:00
|
|
|
commands=mypy --ignore-missing-imports kasa
|
2017-09-18 16:13:06 +00:00
|
|
|
|
2017-01-17 13:38:44 +00:00
|
|
|
[flake8]
|
2019-12-18 08:11:18 +00:00
|
|
|
exclude = .git,.tox,__pycache__,kasa/tests/newfakes.py,kasa/tests/test_fixtures.py
|
2019-11-11 21:14:34 +00:00
|
|
|
max-line-length = 88
|
|
|
|
per-file-ignores =
|
2019-12-18 08:11:18 +00:00
|
|
|
kasa/tests/*.py:D100,D101,D102,D103,D104
|
2019-11-11 21:14:34 +00:00
|
|
|
setup.py:D100
|
|
|
|
ignore = D105, D107, E203, E501, W503
|
|
|
|
#ignore = E203, E266, E501, W503, F403, F401
|
|
|
|
#max-complexity = 18
|
|
|
|
#select = B,C,E,F,W,T4,B9
|
|
|
|
|
|
|
|
[testenv:lint]
|
|
|
|
deps = pre-commit
|
|
|
|
skip_install = true
|
|
|
|
commands = pre-commit run --all-files
|
2018-08-13 18:37:43 +00:00
|
|
|
|
|
|
|
[coverage:run]
|
2019-12-18 08:11:18 +00:00
|
|
|
source = kasa
|
2018-08-13 18:37:43 +00:00
|
|
|
branch = True
|
|
|
|
omit =
|
2019-12-18 08:11:18 +00:00
|
|
|
kasa/tests/*
|
2018-10-19 15:08:00 +00:00
|
|
|
|
|
|
|
[coverage:report]
|
|
|
|
exclude_lines =
|
|
|
|
# ignore abstract methods
|
|
|
|
raise NotImplementedError
|
|
|
|
def __repr__
|
2019-11-11 21:14:34 +00:00
|
|
|
|
|
|
|
[isort]
|
|
|
|
multi_line_output=3
|
|
|
|
include_trailing_comma=True
|
|
|
|
force_grid_wrap=0
|
|
|
|
use_parentheses=True
|
|
|
|
line_length=88
|
2019-12-18 08:11:18 +00:00
|
|
|
known_first_party=kasa
|
|
|
|
known_third_party=click,pytest,setuptools,voluptuous
|