Skip to content

Commit

Permalink
Another attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
dala318 committed Sep 4, 2024
1 parent 9132c66 commit b52b72b
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 54 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/hassfest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ name: Validate with hassfest
on:
push:
pull_request:
schedule:
- cron: "0 0 * * *"
# schedule:
# - cron: "0 0 * * *"

jobs:
validate:
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: actions/checkout@v4
- uses: home-assistant/actions/hassfest@master
29 changes: 0 additions & 29 deletions .github/workflows/pythonpackage.yaml

This file was deleted.

32 changes: 32 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Python tests

on:
workflow_dispatch:
pull_request:
paths:
- '**.py'
push:
paths:
- '**.py'

jobs:
tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.test.txt
- name: Full test with pytest
run: pytest --cov=. --cov-config=.coveragerc --cov-report xml:coverage.xml
10 changes: 9 additions & 1 deletion requirements.test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@
# codecov
# coverage>=5.2.0,<5.3.0
# mypy
# pytest-cov

# fuzzywuzzy
# levenshtein
# ruff
# yamllint

pytest
pytest-asyncio
pytest-cov
pytest-homeassistant-custom-component
22 changes: 1 addition & 21 deletions tests/test_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
async def test_planner_init(hass):
"""Test the planner initialization."""

NAME = "planner name"
NAME = "My planner 1"
TYPE = "moving"
DURATION_ENT = "duration_ent"
SEARCH_LENGTH_ENT = "search_len"
Expand Down Expand Up @@ -46,23 +46,3 @@ async def test_planner_init(hass):
assert planner.name == NAME
assert planner._is_static == False
assert planner._is_moving == True


# @pytest.mark.asyncio
# async def test_flow_init(hass):
# """Test the initial flow."""
# result = await hass.config_entries.flow.async_init(
# config_flow.DOMAIN, context={"source": "user"}
# )

# expected = {
# "data_schema": SCHEMA_COPY,
# # "data_schema": config_flow.DATA_SCHEMA,
# "description_placeholders": None,
# "errors": {},
# "flow_id": mock.ANY,
# "handler": "nordpool_planner",
# "step_id": "user",
# "type": "form",
# }
# assert expected == result

0 comments on commit b52b72b

Please sign in to comment.