Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create pythonpackages workflow #45

Merged
merged 4 commits into from
Jul 13, 2024
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
30 changes: 30 additions & 0 deletions .github/workflows/pythonpackages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Python package

on:
push:
schedule:
- cron: "30 16 * * WED"

jobs:
build:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ["3.12"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.test.txt

- name: Run pytest
run: |
pytest
8 changes: 8 additions & 0 deletions requirements.test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
-r requirements.txt

coverage==7.5.0
pytest==8.2.0
pytest-cov==5.0.0
pytest-aiohttp==1.0.5
pytest-asyncio==0.23.6
pytest-homeassistant-custom-component==0.13.132
9 changes: 9 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[tool:pytest]
testpaths = tests
norecursedirs = .git
addopts =
--strict-markers
--cov=custom_components/teslafi
filterwarnings=
ignore:.*plugin.py:pytest.PytestDeprecationWarning
asyncio_mode = auto
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Tests for TeslaFi integration"""
9 changes: 9 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import pytest

pytest_plugins = "pytest_homeassistant_custom_component"

# This fixture enables loading custom integrations in all tests.
# Remove to enable selective use of this fixture
@pytest.fixture(autouse=True)
def auto_enable_custom_integrations(enable_custom_integrations):
yield
9 changes: 9 additions & 0 deletions tests/test_init.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""Test component setup."""

from homeassistant.setup import async_setup_component

from custom_components.teslafi.const import DOMAIN

async def test_async_setup(hass):
"""Test the component gets setup."""
assert await async_setup_component(hass, DOMAIN, {}) is True
Loading