Skip to content

Commit

Permalink
Merge pull request #9 from nergal/add/config-flow-unit-tests
Browse files Browse the repository at this point in the history
Add unit tests for config_flow
  • Loading branch information
nergal authored Jul 7, 2021
2 parents d1d67e6 + 6383ed2 commit 30c4b9c
Show file tree
Hide file tree
Showing 8 changed files with 712 additions and 23 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/workflow.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
name: Validation flow
on: [push, pull_request]
on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
lint:
ci:
name: Static code checks
strategy:
fail-fast: false
matrix:
Expand All @@ -22,6 +29,8 @@ jobs:
run: poetry install
- name: Run lint checks
run: make lint
- name: Run unit tests
run: make test

analyze:
name: Analyze CodeQL
Expand Down Expand Up @@ -49,13 +58,15 @@ jobs:
uses: github/codeql-action/analyze@v1

validateHassfest:
needs: [lint, analyze]
name: Validate againts HASSFest
needs: [ci, analyze]
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v2"
- uses: home-assistant/actions/hassfest@master

validateHACS:
name: Validate against HACS
needs: [validateHassfest]
runs-on: "ubuntu-latest"
continue-on-error: true # @TODO remove before release
Expand Down
16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
POETRY=poetry
INTEGRATION_FOLDER=custom_components/xiaomi_viomi
INTEGRATION_FOLDER=custom_components
TEST_FOLDER=tests/

ALL_FOLDERS = $(INTEGRATION_FOLDER) $(TEST_FOLDER)

lint: black mypy flake
lintfix: isort blackfix lint
lintfix: isort blackfix lint

mypy:
$(POETRY) run mypy --ignore-missing-imports $(INTEGRATION_FOLDER)
$(POETRY) run mypy --ignore-missing-imports $(ALL_FOLDERS)

flake:
$(POETRY) run flake8 $(INTEGRATION_FOLDER)
$(POETRY) run flake8 $(ALL_FOLDERS)

black:
$(POETRY) run black --check $(INTEGRATION_FOLDER)
$(POETRY) run black --check $(ALL_FOLDERS)

blackfix:
$(POETRY) run black $(INTEGRATION_FOLDER)
$(POETRY) run black $(ALL_FOLDERS)

isort:
$(POETRY) run isort --atomic $(INTEGRATION_FOLDER)
$(POETRY) run isort --atomic $(ALL_FOLDERS)

test:
$(POETRY) run pytest $(TEST_FOLDER)
Expand Down
Empty file added custom_components/__init__.py
Empty file.
Loading

0 comments on commit 30c4b9c

Please sign in to comment.