Skip to content

Commit

Permalink
0.16.2
Browse files Browse the repository at this point in the history
- updated dependencies
- added armv7 and armv6 as docker builds
- activated tests for python 3.9
  • Loading branch information
spacemanspiff2007 authored Nov 5, 2020
1 parent 9905a5a commit 983d08b
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 27 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/publish-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ jobs:
with:
version: latest

- name: Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}

- name: Login to DockerHub
uses: docker/login-action@v1
with:
Expand All @@ -43,6 +40,7 @@ jobs:
uses: docker/build-push-action@v2
with:
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7,linux/arm/v6
tags: |
spacemanspiff2007/habapp:latest
spacemanspiff2007/habapp:${{ steps.latest_version.outputs.latest_tag }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_password }}
password: ${{ secrets.pypi_api_key }}
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ jobs:
python: 3.7
env: TOXENV=py37

# Travis does not support
# - <<: *python_38
# python: 3.9
# env: TOXENV=py39
- <<: *python_38
python: 3.9
env: TOXENV=py39

- <<: *python_38
stage: docs
Expand Down
2 changes: 1 addition & 1 deletion HABApp/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.16.1'
__version__ = '0.16.2'
5 changes: 0 additions & 5 deletions HABApp/openhab/connection_handler/http_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,6 @@ async def start_sse_event_listener():
# cache so we don't have to look up every event
call = ON_SSE_EVENT

options = {}
if HABApp.CONFIG.openhab.connection.user or HABApp.CONFIG.openhab.connection.password:
options['with_credentials'] = True

event_prefix = 'openhab' if not IS_OH2 else 'smarthome'

async with sse_client.EventSource(
Expand All @@ -251,7 +247,6 @@ async def start_sse_event_listener():
f'{event_prefix}/things/*/status,' # Thing status updates
f'{event_prefix}/things/*/statuschanged' # Thing status changes
,
option=options,
session=HTTP_SESSION
) as event_source:
async for event in event_source:
Expand Down
4 changes: 2 additions & 2 deletions HABApp/openhab/events/item_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __repr__(self):


class ItemAddedEvent(OpenhabEvent):
def __init__(self, name: str, type: str):
def __init__(self, name: str = '', type: str = ''):
super().__init__()

self.name: str = name
Expand All @@ -83,7 +83,7 @@ def __repr__(self):


class ItemUpdatedEvent(OpenhabEvent):
def __init__(self, name: str, type: str):
def __init__(self, name: str = '', type: str = ''):
super().__init__()

self.name: str = name
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
aiohttp-sse-client==0.2.0
aiohttp==3.7.1
aiohttp==3.7.2
astral==2.2
bidict==0.21.2
easyco==0.2.2
easyco==0.2.3
paho-mqtt==1.5.1
pydantic==1.6.1
pytz==2020.1
pydantic==1.7.2
pytz==2020.4
stackprinter==0.2.5
tzlocal==2.1
voluptuous==0.12.0
Expand Down
12 changes: 6 additions & 6 deletions tests/test_core/test_utilities.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import asyncio
import sys

import pytest

Expand Down Expand Up @@ -46,14 +45,15 @@ async def b():
nonlocal exception
try:
await asyncio.sleep(200)
except Exception as e:
except BaseException as e:
exception = e

p = PendingFuture(b, 0)
p.reset()
await asyncio.sleep(0.01)
await asyncio.sleep(0.05)
p.reset()
await asyncio.sleep(0.01)
if sys.version_info[:2] != (3, 8):
assert isinstance(exception, asyncio.CancelledError)
await asyncio.sleep(0.05)
p.cancel()

assert exception is not None
assert isinstance(exception, asyncio.CancelledError)
10 changes: 9 additions & 1 deletion tests/test_openhab/test_events/test_from_dict.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import datetime
import pytest

from HABApp.openhab.events import ChannelTriggeredEvent, GroupItemStateChangedEvent, ItemAddedEvent, ItemCommandEvent, \
ItemStateChangedEvent, ItemStateEvent, ItemStatePredictedEvent, ItemUpdatedEvent, ThingConfigStatusInfoEvent, \
ThingStatusInfoChangedEvent, ThingStatusInfoEvent, ThingFirmwareStatusInfoEvent
from HABApp.openhab.map_events import get_event
from HABApp.openhab.map_events import get_event, EVENT_LIST


def test_ItemStateEvent():
Expand Down Expand Up @@ -178,3 +179,10 @@ def test_thing_FirmwareStatusEvent():
event = get_event(data)
assert isinstance(event, ThingFirmwareStatusInfoEvent)
assert event.status == 'UNKNOWN'


@pytest.mark.parametrize('cls', [*EVENT_LIST])
def test_event_has_name(cls):
# this test ensure that alle events have a name argument
c = cls('asdf')
assert c.name == 'asdf'
14 changes: 14 additions & 0 deletions tests/test_openhab/test_items/test_items.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import pytest

import HABApp.openhab.items


@pytest.mark.parametrize('cls', [
getattr(HABApp.openhab.items, i) for i in dir(HABApp.openhab.items) if i[0] != '_' and i[0].isupper()
])
def test_item_has_name(cls):
# this test ensure that alle openhab items inherit from OpenhabItem
c = cls('asdf')
assert c.name == 'asdf'
if cls is not HABApp.openhab.items.Thing:
assert isinstance(c, HABApp.openhab.items.OpenhabItem)

0 comments on commit 983d08b

Please sign in to comment.