Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: CI

on:
push:
branches:
- main
pull_request:

concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
test:
strategy:
fail-fast: false
matrix:
python-version:
- "3.10"
- "3.11"
os:
- ubuntu-latest
- windows-latest
- macOS-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: snok/install-poetry@v1.3.3
- name: Install Dependencies
run: poetry install
shell: bash
- name: Test with Pytest
run: poetry run pytest
shell: bash
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ venv
.idea
roborock/__pycache__
poetry.lock
*.pyc
.coverage
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ packages = [{include = "roborock"}]
roborock = "roborock.cli:main"

[tool.poetry.dependencies]
python = "^3.8"
python = "^3.9"
click = ">=8"
aiohttp = "*"
async-timeout = "*"
Expand All @@ -24,3 +24,7 @@ paho-mqtt = "~1.6.1"
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry.dev-dependencies]
pytest-asyncio = "*"
pytest = "*"

2 changes: 0 additions & 2 deletions roborock/roborock_queue.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import asyncio
from asyncio import Queue
from typing import Any
import async_timeout
Expand All @@ -7,7 +6,6 @@


class RoborockQueue(Queue):

def __init__(self, protocol: int, *args):
super().__init__(*args)
self.protocol = protocol
Expand Down
Empty file added tests/__init__.py
Empty file.
15 changes: 15 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import pytest

from roborock import RoborockMqttClient, UserData, HomeData, RoborockDeviceInfo
from tests.mock_data import USER_DATA, HOME_DATA_RAW


@pytest.fixture(name="mqtt_client")
def mqtt_client():
user_data = UserData(USER_DATA)
home_data = HomeData(HOME_DATA_RAW)
device = RoborockDeviceInfo(home_data.devices[0], home_data.products[0])
device_map = {home_data.devices[0].duid: device}
client = RoborockMqttClient(user_data, device_map)
yield client
# Clean up any resources after the test
Loading