add 'alias' command for querying and setting the alias (#126)

* add 'alias' command for querying and setting the alias

* calculate coverage only on library files, e.g., ignoring cli and test files

* remove py34 and add py37

* readd py33, remove it from travis as it seems to be a travis limitation only

* use xenial dist for travis, regular does not support py37..
This commit is contained in:
Teemu R 2018-08-13 20:37:43 +02:00 committed by GitHub
parent a6d515b5cb
commit ab103c3a1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 5 deletions

View File

@ -1,7 +1,7 @@
sudo: false
language: python
dist: xenial
python:
- "3.3"
- "3.4"
- "3.5"
- "3.6"

View File

@ -111,6 +111,18 @@ def state(ctx, dev):
ctx.invoke(emeter)
@cli.command()
@pass_dev
@click.argument('new_alias', required=False, default=None)
def alias(dev, new_alias):
"""Get or set the device alias."""
if new_alias is not None:
click.echo("Setting alias to %s" % new_alias)
dev.alias = new_alias
click.echo("Alias: %s" % dev.alias)
@cli.command()
@pass_dev
@click.option('--year', type=Datetime(format='%Y'),

15
tox.ini
View File

@ -1,13 +1,13 @@
[tox]
envlist=py33,py34,py35,py36,flake8
envlist=py33,py34,py35,py36,py37,flake8
skip_missing_interpreters = True
[tox:travis]
2.7 = py27
3.3 = py34
3.3 = py33
3.4 = py34
3.5 = py35
3.6 = py36
3.7 = py37
[testenv]
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
@ -17,7 +17,7 @@ deps=
voluptuous
typing
commands=
py.test --cov pyHS100
py.test --cov --cov-config=tox.ini pyHS100
[testenv:flake8]
deps=flake8
@ -29,3 +29,10 @@ commands=mypy --silent-imports pyHS100
[flake8]
exclude = .git,.tox,__pycache__,pyHS100/tests/fakes.py
[coverage:run]
source = pyHS100
branch = True
omit =
pyHS100/cli.py
pyHS100/tests/*