Skip to content

Commit d4e3100

Browse files
BenjiUBenjamin Utz
andauthored
Update Infrastructure, drop python 3.8 due to eol (#432)
* add dill to dev section in .toml * add pylint * fix pylint warnings * deactivate too-many-positional-arguments pylint message * suppress import-untyped for mypy in modules/init * install setuptools for pkg_resources and remove python 3.8 support because eol * add fixme to not working tests * Upgrade CI workflow to use Ubuntu 22.04 * Update base image to Python 3.10.20-slim-trixie (#437) * Update Dockerfile to install poetry-plugin-export * Refactor SHT4x sensor initialization and remove config Remove CONFIG_SCHEMA and update sensor initialization to use default I2C address. --------- Co-authored-by: Benjamin Utz <Benjamin.Utz@mailbox.org>
1 parent 1960d7a commit d4e3100

File tree

12 files changed

+42
-23
lines changed

12 files changed

+42
-23
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-22.04
99
strategy:
1010
matrix:
11-
python-version: ['3.8', '3.10', '3.12']
11+
python-version: ['3.10', '3.12']
1212

1313
steps:
1414
- uses: actions/checkout@v4
@@ -25,12 +25,12 @@ jobs:
2525
- name: Lint with mypy
2626
run: poetry run mypy --show-error-codes --strict --no-warn-unused-ignores mqtt_io
2727
- name: Test with behave
28-
run: poetry run behave -t ~skip mqtt_io/tests/features
28+
run: poetry run behave --tags ~fixme mqtt_io/tests/features
2929

3030
publish:
3131
name: Publish to PyPI
3232
if: github.event_name == 'release' && github.event.action == 'created'
33-
runs-on: ubuntu-20.04
33+
runs-on: ubuntu-22.04
3434
needs: test
3535
steps:
3636
- uses: actions/checkout@v2
@@ -50,7 +50,7 @@ jobs:
5050
build_docker_image:
5151
name: Build Docker Image
5252
if: (github.event_name == 'release' && github.event.action == 'created') || github.event_name == 'push'
53-
runs-on: ubuntu-20.04
53+
runs-on: ubuntu-22.04
5454
needs: test
5555
steps:
5656
- uses: actions/checkout@v2
@@ -80,7 +80,7 @@ jobs:
8080
name: Generate Documentation
8181
if: github.event_name == 'push'
8282
concurrency: generate_docs
83-
runs-on: ubuntu-20.04
83+
runs-on: ubuntu-22.04
8484
steps:
8585
- uses: actions/checkout@v2
8686
with:

.pylintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ disable=
44
unused-argument,
55
duplicate-code,
66
consider-using-f-string,
7-
consider-using-from-import
7+
consider-using-from-import,
8+
too-many-positional-arguments

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# when building multiarch using buildx, then try this:
44
# https://github.com/docker/buildx/issues/495#issuecomment-761562905
55

6-
FROM python:3.8-slim-buster AS base
6+
FROM python:3.10.20-slim-trixie AS base
77

88
ENV LANG C.UTF-8
99
ENV LC_ALL C.UTF-8
@@ -24,7 +24,7 @@ ENV PATH="/root/.cargo/bin:${PATH}"
2424

2525

2626
COPY pyproject.toml ./
27-
RUN pip install --no-cache-dir poetry && \
27+
RUN pip install --no-cache-dir poetry poetry-plugin-export && \
2828
poetry export -o /requirements.txt && \
2929
mkdir -p /home/mqtt_io && \
3030
python -m venv /home/mqtt_io/venv && \

mqtt_io/modules/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
from types import ModuleType
99
from typing import List
1010

11-
import pkg_resources
11+
# pylint: disable=import-error
12+
import pkg_resources # type: ignore
1213

1314
from ..exceptions import CannotInstallModuleRequirements
1415

mqtt_io/modules/sensor/hcsr04.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class HCSR04:
3030
Separate class for the distance sensors themselves, since there may be more than one
3131
attached to the Raspberry Pi's GPIO pins.
3232
"""
33-
3433
def __init__(
3534
self,
3635
gpio: Any,
@@ -39,7 +38,7 @@ def __init__(
3938
pin_trigger: int,
4039
burst: int,
4140
**kwargs: Any
42-
):
41+
) :
4342
self.gpio = gpio
4443
self.name = name
4544
self.pin_echo = pin_echo

mqtt_io/modules/sensor/sht4x.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@ class Sensor(GenericSensor):
1616
Implementation of Sensor class for sht4x.
1717
"""
1818

19+
1920
SENSOR_SCHEMA = {
2021
"type": {
21-
"type": 'string',
22+
"type": "string",
2223
"required": False,
2324
"empty": False,
24-
"default": 'temperature',
25-
"allowed": ['temperature', 'humidity'],
25+
"default": "temperature",
26+
"allowed": ["temperature", "humidity"],
2627
}
2728
}
2829

mqtt_io/modules/sensor/veml6075.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ def setup_module(self) -> None:
5959
self.sensor.set_integration_time('100ms')
6060
self.sensor.set_shutdown(False)
6161

62-
6362
def calculate_uv_index(self, sens_conf: ConfigType, \
6463
uva: float, uvb: float, uv_comp1: float, uv_comp2: float) -> float:
6564

mqtt_io/tests/features/config_main_invalid.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Feature: Invalid main config validation
9595
When we validate the main config
9696
Then config validation fails
9797

98-
@skip
98+
@fixme
9999
Scenario: Configuring a GPIO module's pin as a digital input twice should fail
100100
Given a valid config
101101
And the config has an entry in gpio_modules with
@@ -118,7 +118,7 @@ Feature: Invalid main config validation
118118
When we validate the main config
119119
Then config validation fails
120120

121-
@skip
121+
@fixme
122122
Scenario: Configuring a GPIO module's pin as a digital output twice should fail
123123
Given a valid config
124124
And the config has an entry in gpio_modules with
@@ -141,7 +141,7 @@ Feature: Invalid main config validation
141141
When we validate the main config
142142
Then config validation fails
143143

144-
@skip
144+
@fixme
145145
Scenario: Configuring a GPIO module's pin as a digital output and a digital input should fail
146146
Given a valid config
147147
And the config has an entry in gpio_modules with

mqtt_io/tests/features/module_gpio_runtime.feature

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ Feature: GPIO module runtime
9393
And mock1 reads a value of false with a last value of true
9494
Then handle_remote_interrupt on MqttIo shouldn't be called
9595

96+
@fixme
9697
Scenario: Non-inverted value is published on DigitalInputChangedEvent to_value True
9798
Given a valid config
9899
And the config has an entry in gpio_modules with
@@ -124,6 +125,7 @@ Feature: GPIO module runtime
124125
payload: "ON"
125126
"""
126127

128+
@fixme
127129
Scenario: Non-inverted value is published on DigitalInputChangedEvent to_value True when interrupt comes from other thread
128130
Given a valid config
129131
And the config has an entry in gpio_modules with
@@ -155,6 +157,7 @@ Feature: GPIO module runtime
155157
payload: "ON"
156158
"""
157159

160+
@fixme
158161
Scenario: Inverted value is published on DigitalInputChangedEvent to_value True
159162
Given a valid config
160163
And the config has an entry in gpio_modules with
@@ -187,6 +190,7 @@ Feature: GPIO module runtime
187190
payload: "OFF"
188191
"""
189192

193+
@fixme
190194
Scenario: Non-inverted value is published on DigitalInputChangedEvent to_value False
191195
Given a valid config
192196
And the config has an entry in gpio_modules with
@@ -218,6 +222,7 @@ Feature: GPIO module runtime
218222
payload: "OFF"
219223
"""
220224

225+
@fixme
221226
Scenario: Inverted value is published on DigitalInputChangedEvent to_value False
222227
Given a valid config
223228
And the config has an entry in gpio_modules with

mqtt_io/tests/features/server_init_gpio.feature

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ Feature: Tests for the successful initialisation of the GPIO aspects of the serv
158158
And a digital input poller task isn't added for mock0
159159
And a digital output loop task is added for GPIO module mock
160160

161+
@fixme
161162
Scenario: Digital output publishes initial high/on value when publish_initial=True
162163
Given a valid config
163164
And the config has an entry in gpio_modules with
@@ -185,6 +186,7 @@ Feature: Tests for the successful initialisation of the GPIO aspects of the serv
185186
payload: "ON"
186187
"""
187188

189+
@fixme
188190
Scenario: Digital output publishes initial low/off value when publish_initial=True
189191
Given a valid config
190192
And the config has an entry in gpio_modules with
@@ -213,6 +215,7 @@ Feature: Tests for the successful initialisation of the GPIO aspects of the serv
213215
"""
214216

215217

218+
@fixme
216219
Scenario: Inverted digital output publishes initial high/off value when publish_initial=True
217220
Given a valid config
218221
And the config has an entry in gpio_modules with
@@ -241,6 +244,7 @@ Feature: Tests for the successful initialisation of the GPIO aspects of the serv
241244
payload: "OFF"
242245
"""
243246

247+
@fixme
244248
Scenario: Inverted digital output publishes initial low/on value when publish_initial=True
245249
Given a valid config
246250
And the config has an entry in gpio_modules with
@@ -269,6 +273,7 @@ Feature: Tests for the successful initialisation of the GPIO aspects of the serv
269273
payload: "ON"
270274
"""
271275

276+
@fixme
272277
Scenario: Digital output publishes ON when turned on
273278
Given a valid config
274279
And the config has an entry in gpio_modules with
@@ -295,6 +300,7 @@ Feature: Tests for the successful initialisation of the GPIO aspects of the serv
295300
payload: "ON"
296301
"""
297302

303+
@fixme
298304
Scenario: Digital output publishes OFF when turned off
299305
Given a valid config
300306
And the config has an entry in gpio_modules with
@@ -321,6 +327,7 @@ Feature: Tests for the successful initialisation of the GPIO aspects of the serv
321327
payload: "OFF"
322328
"""
323329

330+
@fixme
324331
Scenario: Inverted digital output publishes ON when turned on
325332
Given a valid config
326333
And the config has an entry in gpio_modules with
@@ -347,7 +354,8 @@ Feature: Tests for the successful initialisation of the GPIO aspects of the serv
347354
"""
348355
payload: "ON"
349356
"""
350-
357+
358+
@fixme
351359
Scenario: Inverted digital output publishes OFF when turned off
352360
Given a valid config
353361
And the config has an entry in gpio_modules with
@@ -373,4 +381,4 @@ Feature: Tests for the successful initialisation of the GPIO aspects of the serv
373381
Then _mqtt_publish on MqttIo should be called with MQTT message
374382
"""
375383
payload: "OFF"
376-
"""
384+
"""

0 commit comments

Comments
 (0)