Skip to content

Commit 8e87329

Browse files
Migrate to Github Action + Update username
1 parent 929e6a8 commit 8e87329

File tree

3 files changed

+83
-45
lines changed

3 files changed

+83
-45
lines changed

.github/workflows/ci.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master, main]
6+
pull_request:
7+
branches: [master, main]
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
17+
fail-fast: false
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install tox
31+
32+
- name: Test with tox
33+
run: tox -e py$(echo ${{ matrix.python-version }} | sed 's/\.//')
34+
35+
- name: Upload coverage reports
36+
if: matrix.python-version == '3.11'
37+
uses: codecov/codecov-action@v3
38+
with:
39+
fail_ci_if_error: false
40+
41+
deploy:
42+
needs: test
43+
runs-on: ubuntu-latest
44+
if: github.event_name == 'release' && github.event.action == 'published'
45+
46+
steps:
47+
- uses: actions/checkout@v4
48+
49+
- name: Set up Python
50+
uses: actions/setup-python@v4
51+
with:
52+
python-version: "3.11"
53+
54+
- name: Install dependencies
55+
run: |
56+
python -m pip install --upgrade pip
57+
pip install build twine
58+
59+
- name: Build package
60+
run: python -m build
61+
62+
- name: Publish to PyPI
63+
env:
64+
TWINE_USERNAME: __token__
65+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
66+
run: twine upload dist/*

.travis.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Appdaemon Test Framework
22

3-
[![Build Status](https://www.travis-ci.com/FlorianKempenich/Appdaemon-Test-Framework.svg?branch=master)](https://travis-ci.com/github/FlorianKempenich/Appdaemon-Test-Framework) [![PyPI](https://img.shields.io/pypi/v/appdaemontestframework.svg)](https://pypi.org/project/appdaemontestframework/)
3+
[![CI](https://github.com/HelloThisIsFlo/Appdaemon-Test-Framework/actions/workflows/ci.yml/badge.svg)](https://github.com/HelloThisIsFlo/Appdaemon-Test-Framework/actions/workflows/ci.yml) [![PyPI](https://img.shields.io/pypi/v/appdaemontestframework.svg)](https://pypi.org/project/appdaemontestframework/)
44

55
Clean, human-readable tests for your Appdaemon automations.
66

@@ -88,7 +88,7 @@ Let's test an Appdaemon automation we created, which, say, handles automatic lig
8888
```
8989
> ##### Note
9090
>
91-
> The following fixtures are **injected** by pytest using the **[`conftest.py`](https://github.com/FlorianKempenich/Appdaemon-Test-Framework/blob/new-features/doc/full_example/conftest.py) file** and the **initialisation fixture created at Step 1**:
91+
> The following fixtures are **injected** by pytest using the **[`conftest.py`](https://github.com/HelloThisIsFlo/Appdaemon-Test-Framework/blob/new-features/doc/full_example/conftest.py) file** and the **initialisation fixture created at Step 1**:
9292
>
9393
> - `living_room`
9494
> - `given_that`
@@ -337,7 +337,7 @@ class LivingRoom(hass.Hass):
337337

338338
**NOTE:** The above examples can be used with run_minutely.
339339

340-
_See related test file for more examples: [test_assert_callback_registration.py](https://github.com/FlorianKempenich/Appdaemon-Test-Framework/blob/master/test/test_assert_callback_registration.py)_
340+
_See related test file for more examples: [test_assert_callback_registration.py](https://github.com/HelloThisIsFlo/Appdaemon-Test-Framework/blob/master/test/test_assert_callback_registration.py)_
341341

342342
### Bonus — Travel in Time: `time_travel`
343343

@@ -384,8 +384,8 @@ assert_that('some_other/service').was.called()
384384

385385
### Simple
386386

387-
- [**Pytest**](https://github.com/FlorianKempenich/Appdaemon-Test-Framework/blob/master/doc/pytest_example.py)
388-
- [**Unittest**](https://github.com/FlorianKempenich/Appdaemon-Test-Framework/blob/master/doc/unittest_example.py)
387+
- [**Pytest**](https://github.com/HelloThisIsFlo/Appdaemon-Test-Framework/blob/master/doc/pytest_example.py)
388+
- [**Unittest**](https://github.com/HelloThisIsFlo/Appdaemon-Test-Framework/blob/master/doc/unittest_example.py)
389389

390390
### Special cases
391391

@@ -442,14 +442,14 @@ class AfterLightTurnedOnByMotion:
442442

443443
```
444444

445-
### [Complete Project](https://github.com/FlorianKempenich/Appdaemon-Test-Framework/tree/master/doc/full_example)
445+
### [Complete Project](https://github.com/HelloThisIsFlo/Appdaemon-Test-Framework/tree/master/doc/full_example)
446446

447447
- **Kitchen**
448-
- [**Automation**](https://github.com/FlorianKempenich/Appdaemon-Test-Framework/blob/master/doc/full_example/apps/kitchen.py)
449-
- [**Tests**](https://github.com/FlorianKempenich/Appdaemon-Test-Framework/blob/master/doc/full_example/tests/test_kitchen.py)
448+
- [**Automation**](https://github.com/HelloThisIsFlo/Appdaemon-Test-Framework/blob/master/doc/full_example/apps/kitchen.py)
449+
- [**Tests**](https://github.com/HelloThisIsFlo/Appdaemon-Test-Framework/blob/master/doc/full_example/tests/test_kitchen.py)
450450
- **Bathroom**
451-
- [**Automation**](https://github.com/FlorianKempenich/Appdaemon-Test-Framework/blob/master/doc/full_example/apps/bathroom.py)
452-
- [**Tests**](https://github.com/FlorianKempenich/Appdaemon-Test-Framework/blob/master/doc/full_example/tests/test_bathroom.py)
451+
- [**Automation**](https://github.com/HelloThisIsFlo/Appdaemon-Test-Framework/blob/master/doc/full_example/apps/bathroom.py)
452+
- [**Tests**](https://github.com/HelloThisIsFlo/Appdaemon-Test-Framework/blob/master/doc/full_example/tests/test_bathroom.py)
453453

454454
---
455455

@@ -468,7 +468,7 @@ This test framework abstracts away all that complexity, allowing for a smooth TD
468468
**Couldn't we just use the MVP pattern with clear interfaces at the boundaries?**
469469
_Yes we could... but would we?
470470
Let's be pragmatic, with this kind of project we're developing for our home, and we're a team of one.
471-
While being a huge proponent for [clean architecture](https://floriankempenich.com/post/11), I believe using such a complex architecture for such a simple project would only result in bringing more complexity than necessary._
471+
While being a huge proponent for [clean architecture](https://professionalbeginner.com/post/11), I believe using such a complex architecture for such a simple project would only result in bringing more complexity than necessary._
472472

473473
### Enjoy the simplicity
474474

@@ -492,7 +492,7 @@ After all tests have run, the `hass_mocks` test fixture will automatically unpat
492492
**`hass_functions`** are injected in the helpers when creating their instances.
493493
After all tests, **`unpatch_callback`** is used to un-patch all patched functions.
494494

495-
Setup and teardown are handled in the [`pytest_conftest.py`](https://github.com/FlorianKempenich/Appdaemon-Test-Framework/blob/master/appdaemontestframework/pytest_conftest.py) file.
495+
Setup and teardown are handled in the [`pytest_conftest.py`](https://github.com/HelloThisIsFlo/Appdaemon-Test-Framework/blob/master/appdaemontestframework/pytest_conftest.py) file.
496496

497497
#### Appdaemon Test Framework flow
498498

@@ -646,16 +646,16 @@ pytest -W ignore::DeprecationWarning
646646
If you do no wish to use `pytest`, first maybe reconsider, `pytest` is awesome :)
647647
If you're really set on using something else, worry not it's pretty straighforward too ;)
648648

649-
What the [`conftest.py`](https://github.com/FlorianKempenich/Appdaemon-Test-Framework/blob/new-features/doc/full_example/conftest.py) file is doing is simply handling the setup & teardown, as well as providing the helpers as injectable fixtures.
650-
It is pretty easy to replicate the same behavior with your test framework of choice. For instance, with `unittest` a base `TestCase` can replace pytest [`conftest.py`](https://github.com/FlorianKempenich/Appdaemon-Test-Framework/blob/new-features/doc/full_example/conftest.py). See the [Unittest Example](https://github.com/FlorianKempenich/Appdaemon-Test-Framework/blob/master/doc/unittest_example.py)
649+
What the [`conftest.py`](https://github.com/HelloThisIsFlo/Appdaemon-Test-Framework/blob/new-features/doc/full_example/conftest.py) file is doing is simply handling the setup & teardown, as well as providing the helpers as injectable fixtures.
650+
It is pretty easy to replicate the same behavior with your test framework of choice. For instance, with `unittest` a base `TestCase` can replace pytest [`conftest.py`](https://github.com/HelloThisIsFlo/Appdaemon-Test-Framework/blob/new-features/doc/full_example/conftest.py). See the [Unittest Example](https://github.com/HelloThisIsFlo/Appdaemon-Test-Framework/blob/master/doc/unittest_example.py)
651651

652652
### Direct call to mocked functions
653653

654654
> /!\ WARNING — EXPERIMENTAL /!\
655655

656656
**Want a functionality not implemented by the helpers?**
657657
You can inject `hass_mocks` directly in your tests and use `hass_mocks.hass_functions`, patched functions are `MagicMocks`.
658-
The list of patched functions can be found in the [**`hass_mocks` module**](https://github.com/FlorianKempenich/Appdaemon-Test-Framework/blob/master/appdaemontestframework/hass_mocks.py#L20framework.py#L14).
658+
The list of patched functions can be found in the [**`hass_mocks` module**](https://github.com/HelloThisIsFlo/Appdaemon-Test-Framework/blob/master/appdaemontestframework/hass_mocks.py#L20framework.py#L14).
659659

660660
---
661661

@@ -706,5 +706,5 @@ If you prefer using pip:
706706

707707
## Author Information
708708

709-
Follow me on Twitter: [@ThisIsFlorianK](https://twitter.com/ThisIsFlorianK)
710-
Find out more about my work: [Florian Kempenich — Personal Website](https://floriankempenich.com)
709+
Follow me on Twitter: [@HelloThisIsFlo](https://twitter.com/HelloThisIsFlo)
710+
Find out more about my work: [Flo Kempenich — Personal Website](https://professionalbeginner.com)

0 commit comments

Comments
 (0)