Skip to content

Commit 2b7da96

Browse files
committed
Update tox and get tests running on Python 3.6 - 3.8
1 parent 08ef3f2 commit 2b7da96

File tree

11 files changed

+124
-129
lines changed

11 files changed

+124
-129
lines changed

.travis.yml

+8-17
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,20 @@ install:
1111

1212
jobs:
1313
include:
14-
- python: 2.7
15-
stage: test
16-
script: tox -e py27
17-
1814
- python: 3.6
1915
stage: test
2016
script: tox -e py36
2117

22-
- stage: publish
23-
script: skip
24-
python: 2.7
25-
deploy:
26-
provider: pypi
27-
user: flyte
28-
password:
29-
secure: "eSedXSEOXM+YGl+zQUjDg2EGhTIHfiMBn2Bcrx5Gyinx19Z9vaL/oy6wUw+0bpA3hztQZzgFwxxgAlEvvp9xoWknR+9AWUYlmmruWrZMcnxWG6d+kTmLehQ+xetObgqszZorVC/WmvvL7t6Tuyh/DHZZ3nw5T817jOg243eXVaQr53UFL20879I7elnRc1gGZOz9GuFMJRhGqX3D3tgseR3sKI7IYSOLNVYfJGN9FVdbn8qMcdb6Q8Ecb1RtmmK5p3uBTFe0rSZrhBD3gWjxFrpojSSsrve/duxHkY0c5ZQkv3uihFLzyLh7a8r8HW8sC7uej+HOr989Y9I6So86BHcqynKIZjrXknEsffAeCf/81hrr6Q4hiwNi+d3adnDWz2SwfYF9LvPRYJLguyKSHdjkKp8OJcJedi9rdF6CxX1Tz5RqndZLUkJH4Eybsjf65xJ4KnSbFKizESGzA9ecwCddp39lUt87bto9pZ9uXpxkKm5PLYJVxint1F1Y3C4yq5zDcRsv2J7GKFVsvfkd++N3NMaTm80bxo2sJnw0xoLr3nokzHICkgr5aUuxipYiDt0tiI3xV7k0jRqQM2dsY5Dqq31Sz7CRHVg9JaBcRe58FMrKsKnBisPbzCpAX8xbR/eXo+Y+CIi3ABf9txMz+qft8/LXEJGel2J0srOZCcQ="
30-
on:
31-
tags: true
32-
repo: flyte/pi-mqtt-gpio
33-
distributions: bdist_wheel
18+
- python: 3.7
19+
stage: test
20+
script: tox -e py37
21+
22+
- python: 3.8
23+
stage: test
24+
script: tox -e py38
3425

3526
- stage: publish
36-
python: 3.6
27+
python: 3.8
3728
script: skip
3829
deploy:
3930
provider: pypi

MANIFEST.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# http://packages.python.org/distribute/setuptools.html#including-data-files
22
include *requirements.txt
3-
include mqtt_io/config.schema.yml
3+
include mqtt_io/config/config.schema.yml

Makefile

+1-6
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,12 @@ packages: clean schema sdist wheel2 wheel3
66
sdist: schema
77
python setup.py sdist
88

9-
wheel2: schema
10-
python2 setup.py bdist_wheel
11-
129
wheel3: schema
1310
python3 setup.py bdist_wheel
1411

1512
clean:
16-
cp pi_mqtt_gpio/__init__.py.die pi_mqtt_gpio/__init__.py
17-
rm -rf .cache .eggs build *.egg-info
1813
find pi_mqtt_gpio -type d -name __pycache__ -prune -exec rm -rf {} \;
19-
rm -rf dist
14+
rm -rf dist .eggs .mypy_cache .pytest_cache *.egg-info
2015

2116
upload: packages
2217
twine upload dist/*

Pipfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ hbmqtt = "*"
1616
typing-extensions = "*"
1717

1818
[requires]
19-
python_version = "3.6"
19+
python_version = ">=3.6"
2020

2121
[pipenv]
22-
allow_prereleases = true
22+
allow_prereleases = false

Pipfile.lock

+12-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mqtt_io/config/__init__.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
Handles config validation and normalisation.
33
"""
44

5-
from __future__ import annotations
6-
75
import logging
86
from collections import Counter
97
from os.path import dirname, join, realpath
@@ -72,8 +70,9 @@ def get_main_schema() -> ConfigType:
7270
:rtype: dict
7371
"""
7472
schema_path = join(dirname(realpath(__file__)), "config.schema.yml")
75-
# We write this schema file, so we know it'll adhere to ConfigType rules
76-
return cast(ConfigType, yaml.safe_load(open(schema_path)))
73+
with open(schema_path) as schema_file:
74+
# We write this schema file, so we know it'll adhere to ConfigType rules
75+
return cast(ConfigType, yaml.safe_load(schema_file))
7776

7877

7978
def get_main_schema_section(section: str) -> ConfigType:
@@ -184,7 +183,7 @@ def validate_and_normalise_main_config(raw_config: Any) -> ConfigType:
184183

185184

186185
def validate_and_normalise_sensor_input_config(
187-
config: ConfigType, module: GenericSensor
186+
config: ConfigType, module: "GenericSensor"
188187
) -> ConfigType:
189188
"""
190189
Validate sensor input configs.
@@ -196,7 +195,7 @@ def validate_and_normalise_sensor_input_config(
196195

197196

198197
def validate_and_normalise_digital_input_config(
199-
config: ConfigType, module: GenericGPIO
198+
config: ConfigType, module: "GenericGPIO"
200199
) -> ConfigType:
201200
"""
202201
Validate digital input configs.
@@ -211,7 +210,7 @@ def validate_and_normalise_digital_input_config(
211210

212211

213212
def validate_and_normalise_digital_output_config(
214-
config: ConfigType, module: GenericGPIO
213+
config: ConfigType, module: "GenericGPIO"
215214
) -> ConfigType:
216215
"""
217216
Validate digital output configs.

mqtt_io/home_assistant.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
https://www.home-assistant.io/docs/mqtt/discovery/
55
"""
66

7-
from __future__ import annotations
8-
97
import json
108
import logging
119
from typing import TYPE_CHECKING
@@ -20,7 +18,7 @@
2018

2119

2220
async def hass_announce_digital_input(
23-
in_conf: ConfigType, mqtt_config: ConfigType, mqtt_client: MQTTClient
21+
in_conf: ConfigType, mqtt_config: ConfigType, mqtt_client: "MQTTClient"
2422
) -> None:
2523
"""
2624
Announces digital input as binary_sensor to HomeAssistant.
@@ -66,7 +64,7 @@ async def hass_announce_digital_input(
6664

6765

6866
async def hass_announce_digital_output(
69-
out_conf: ConfigType, mqtt_config: ConfigType, mqtt_client: MQTTClient
67+
out_conf: ConfigType, mqtt_config: ConfigType, mqtt_client: "MQTTClient"
7068
) -> None:
7169
"""
7270
Announces digital output as switch to HomeAssistant.
@@ -115,7 +113,7 @@ async def hass_announce_digital_output(
115113

116114

117115
async def hass_announce_sensor_input(
118-
sens_conf: ConfigType, mqtt_config: ConfigType, mqtt_client: MQTTClient
116+
sens_conf: ConfigType, mqtt_config: ConfigType, mqtt_client: "MQTTClient"
119117
) -> None:
120118
"""
121119
Announces digital output as sensor to HomeAssistant.

mqtt_io/server.py

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
# pylint: enable=duplicate-code
99
# pylint: disable=too-many-lines
1010

11-
from __future__ import annotations
12-
1311
import asyncio
1412
import logging
1513
import re

0 commit comments

Comments
 (0)