Skip to content
Merged

Testing #2420

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
c486c10
started tests and reworked datetime parsing and timer resetting
jsl12 Jun 23, 2025
e8e6bba
added startup test
jsl12 Jun 26, 2025
6f312fa
added default asyncio loop scope for tests
jsl12 Jun 26, 2025
87e0e38
asyncio_default_fixture_loop_scope
jsl12 Jun 26, 2025
1ee10f4
formatting
jsl12 Jun 27, 2025
8e4ccbc
formatting
jsl12 Jun 27, 2025
a5a23be
fixed timewarp for testing
jsl12 Jun 27, 2025
79df13d
rough run_every test
jsl12 Jun 28, 2025
39611cb
added type check
jsl12 Jun 28, 2025
5b6b560
added disable check
jsl12 Jun 28, 2025
59d4e18
dep manager initialize check
jsl12 Jun 28, 2025
8a75b56
added run_app_temporarily
jsl12 Jun 28, 2025
e102482
return task coro from stop
jsl12 Jun 28, 2025
0e00c1b
broke apart utility loop
jsl12 Jun 30, 2025
3ca6167
types
jsl12 Jun 30, 2025
be9dba3
loop cleanup
jsl12 Jun 30, 2025
3f49984
moved thread_async
jsl12 Jun 30, 2025
e4e1b14
only including running apps for terminate mode
jsl12 Jun 30, 2025
6b9fdaf
Merge branch 'test-restructure'
jsl12 Jul 10, 2025
c3e8923
more testing work
jsl12 Jul 11, 2025
3c55263
started context managers to help with testing
jsl12 Jul 11, 2025
6d3f17a
created context manager
jsl12 Jul 11, 2025
46384c7
comments and touch ups
jsl12 Jul 11, 2025
ad7b439
rename
jsl12 Jul 11, 2025
0607a9b
shifts
jsl12 Jul 11, 2025
3c0c035
moved logic into create_app_object
jsl12 Jul 11, 2025
4d0f0fd
reworked __main__ and added an ExitStack
jsl12 Jul 14, 2025
c47e913
Merge branch 'stop-event'
jsl12 Jul 17, 2025
2239e58
Merge branch 'context-managers'
jsl12 Jul 25, 2025
a22f4c1
Merge branch 'file-loading'
jsl12 Jul 31, 2025
7f48f98
Merge branch 'multi-tests'
jsl12 Aug 9, 2025
3cb85e0
Merge branch 'tests'
jsl12 Aug 10, 2025
654000c
Merge branch 'run-every'
jsl12 Aug 12, 2025
0b8cb45
added a buffer to get_next_period
jsl12 Aug 12, 2025
70d8277
python 3.10 fix
jsl12 Aug 13, 2025
06c6d71
fixed TimeoutError exception and ruff formating
jsl12 Aug 13, 2025
4d6907b
marked unittests for CI and consolidated test line
jsl12 Aug 13, 2025
adbadef
linting
jsl12 Aug 13, 2025
e7ae491
Merge branch 'testing-docs'
jsl12 Aug 21, 2025
537ff4e
Merge branch 'testing-docs'
jsl12 Aug 23, 2025
f24497f
Merge branch 'datetime-testing'
jsl12 Aug 24, 2025
c605b3b
Fix ignore of events during app initialize()
acockburn Aug 30, 2025
57948e1
Merge branch 'datetime-parsing'
jsl12 Aug 31, 2025
3c6e208
pruning
jsl12 Aug 31, 2025
c7f9f24
Merge branch 'init-event-discard'
jsl12 Aug 31, 2025
0de3fa3
Merge branch 'thread-cleanup'
jsl12 Aug 31, 2025
cef371c
default fix
jsl12 Aug 31, 2025
0cc7ccc
doc updates
jsl12 Aug 31, 2025
3e71ce0
fixes for typing issues
jsl12 Aug 31, 2025
4cd1908
updated tasks to use uv and added docker multiplatform build script
jsl12 Aug 31, 2025
ac645a5
added tests to ruff option
jsl12 Aug 31, 2025
6df15c8
pointed at default dockerfile
jsl12 Aug 31, 2025
2c64578
validation bugfix
jsl12 Aug 31, 2025
787b0c4
lint fix
jsl12 Aug 31, 2025
f8410d4
doc updates
jsl12 Sep 2, 2025
644665e
version bumps
jsl12 Sep 5, 2025
6eaf87a
added discard_init_events config option
jsl12 Sep 5, 2025
9645a5e
added another time format
jsl12 Sep 5, 2025
144650f
change history
jsl12 Sep 5, 2025
0e82585
added test_immediate_callback
jsl12 Sep 5, 2025
dec5429
started run_daily tests
jsl12 Sep 5, 2025
b5d9741
Hostory edit
acockburn Sep 5, 2025
61e19d0
discard_init_events doc entry
acockburn Sep 5, 2025
57e737f
make log warning for `discard_init_events` info level
acockburn Sep 5, 2025
cd1d524
doc content
jsl12 Sep 6, 2025
f0f7974
entity api fixes
jsl12 Sep 6, 2025
d255a5e
Merge branch 'hass-connection'
jsl12 Sep 8, 2025
2992861
Merge branch 'hass-connection-improvements'
jsl12 Sep 11, 2025
6513459
moved history updates to 4.5.12
jsl12 Sep 12, 2025
078559c
stopping fixes
jsl12 Sep 13, 2025
2b0741c
typing fixes
jsl12 Sep 13, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: Build and deploy

on:
push:
branches: ["**"]
branches: ["dev"]
tags: ["*"]
pull_request:
branches: ["dev"]
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
name: python-package
path: dist/
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3.10.0
uses: docker/setup-buildx-action@v3.11.1
# Login against a Docker registry (only with a tag or push on `dev` branch)
# https://github.com/docker/login-action
- name: Log into Docker Hub
Expand Down
71 changes: 46 additions & 25 deletions .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,33 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# https://github.com/actions/setup-python
- name: Set up Python
uses: actions/setup-python@v5
- name: Install uv and set the python version
id: setup-uv
uses: astral-sh/setup-uv@v6
with:
python-version: '3.12'
cache: 'pip' # caching pip dependencies
# Manually set pyproject.toml as the file to use for dependencies
# Workaround while waiting for https://github.com/actions/setup-python/issues/529
cache-dependency-path: 'pyproject.toml'
- name: Run pre-commit
uses: pre-commit/[email protected]
- uses: pre-commit-ci/[email protected]
if: always()
version: "0.8.15" # It is considered best practice to pin to a specific uv version
# https://github.com/astral-sh/setup-uv?tab=readme-ov-file#enable-caching
enable-cache: true
cache-dependency-glob: |
**/*requirements*.txt
**/pyproject.toml
**/uv.lock

- name: Do something if the cache was restored
if: steps.setup-uv.outputs.cache-hit == 'true'
run: echo "Cache was restored"

- name: Install the project
run: uv sync --all-extras --dev

- name: Run pre-commit hooks
run: >
uv run pre-commit
run --all-files
--show-diff-on-failure --color=always

test:
needs: lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -36,18 +48,27 @@ jobs:

steps:
- uses: actions/checkout@v4
# https://github.com/actions/setup-python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
- name: Install uv and set the python version
id: setup-uv
uses: astral-sh/setup-uv@v6
with:
# https://docs.astral.sh/uv/guides/integration/github/#multiple-python-versions
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
# Manually set 'dev-requirements.txt' as the file to use for dependencies, since `requirements.txt` contains runtime dependencies.
cache-dependency-path: 'dev-requirements.txt'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r dev-requirements.txt
- name: Test with pytest
run: |
python -m pytest
version: "0.8.15" # It is considered best practice to pin to a specific uv version
# https://github.com/astral-sh/setup-uv?tab=readme-ov-file#enable-caching
enable-cache: true
cache-dependency-glob: |
**/*requirements*.txt
**/pyproject.toml
**/uv.lock

- name: Do something if the cache was restored
if: steps.setup-uv.outputs.cache-hit == 'true'
run: echo "Cache was restored"

- name: Install the project
run: uv sync --all-extras --dev

- name: Run tests
# For example, using `pytest`
run: uv run pytest -m ci
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ __pycache__/
.Python
env/
build/
docker_build/
docs_build/
develop-eggs/
dist/
Expand Down Expand Up @@ -65,6 +66,7 @@ target/
venv
.venv
uv.lock
*.ipynb

# Mac stuff
.DS_Store
Expand Down
9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
{
"ruff.configuration": "pyproject.toml",
"notebook.defaultFormatter": "charliermarsh.ruff",
"ruff.lineLength": 200
"ruff.lineLength": 200,
"python.analysis.typeCheckingMode": "basic",
"python.testing.pytestArgs": [
"-s",
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.testing.autoTestDiscoverOnSavePattern": "tests/**/*.py",
}
129 changes: 101 additions & 28 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,111 +18,184 @@
},
},
{
"label": "Build Docs",
"command": "sphinx-build",
"args": ["-T", "-E", "${workspaceFolder}/docs", "${workspaceFolder}/.docs_build"],
"label": "Build Package",
"detail": "Builds the package as a wheel file in the dist/ directory",
"type": "shell",
"problemMatcher": [],
"command": "uv",
"args": ["build", "--wheel"],
"presentation":
{
"echo": true,
"reveal": "always",
"clear": true,
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
},
{
"label": "Auto Build Docs",
"command": "sphinx-autobuild",
"args": ["-T", "-E", "${workspaceFolder}/docs", "${workspaceFolder}/.docs_build", "--port", "9999"],
"label": "Build Docker Image",
"detail": "Builds the Docker image for the application",
"dependsOn": "Build Package",
"type": "shell",
"problemMatcher": [],
"command": "docker",
"args": [
"build",
"-t", "acockburn/appdaemon:local-dev",
// "-f", "Dockerfile.uv",
"${workspaceFolder}"
],
"presentation":
{
"reveal": "always",
"clear": true,
"focus": false,
"panel": "shared",
},
},
{
"label": "Build Multi-Platform Docker Images",
"detail": "Builds Docker images for multiple platforms and analyzes their sizes",
"type": "shell",
"problemMatcher": [],
"command": "${workspaceFolder}/scripts/multiplatform-docker-build.sh",
"group": "build",
"presentation":
{
"reveal": "always",
"clear": true,
"focus": true,
"panel": "shared",
},
},
{
"label": "Build Docs",
"detail": "Builds the docs into a self-contained set of HTML files using Sphinx",
"type": "shell",
"problemMatcher": [],
"command": "uv",
"args": [
"run", "--extra", "doc",
"sphinx-build", "-T", "-E",
"${workspaceFolder}/docs",
"${workspaceFolder}/.docs_build"
],
"presentation":
{
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"showReuseMessage": true,
"clear": true
},
},
{
"label": "Build Package",
"label": "Auto Build Docs",
"detail": "Runs the Sphinx documentation server on localhost:9999 with live reloading.",
"type": "process",
"problemMatcher": [],
"command": "uv",
"args": ["build"],
"type": "shell",
"args": [
"run", "--extra", "doc",
"sphinx-autobuild", "-T", "-E",
"${workspaceFolder}/docs",
"${workspaceFolder}/.docs_build",
"--port", "9999",
"--watch", "${workspaceFolder}/appdaemon",
"--watch", "${workspaceFolder}/tests",
],
"presentation":
{
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"showReuseMessage": true,
"clear": true
},
},
{
"label": "Build Runtime Requirements",
"command": "uv",
"args": ["pip", "compile", "--resolver=backtracking", "--upgrade", "pyproject.toml"],
"type": "shell",
"problemMatcher": [],
"command": "uv",
"args": ["pip", "compile", "--upgrade", "pyproject.toml"],
"presentation":
{
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"group": "requirements",
"showReuseMessage": true,
"clear": true
},
},
{
"label": "Build Dev Requirements",
"command": "uv",
"args": ["pip", "compile", "--extra=dev", "--output-file=dev-requirements.txt", "--resolver=backtracking", "--upgrade", "pyproject.toml"],
"type": "shell",
"problemMatcher": [],
"command": "uv",
"args": [
"pip", "compile",
"--extra=dev",
"--output-file=dev-requirements.txt",
"--upgrade", "pyproject.toml"
],
"presentation":
{
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"group": "requirements",
"showReuseMessage": true,
"clear": true
},
},
{
"label": "Build Doc Requirements",
"command": "uv",
"args": ["pip", "compile", "--extra=doc", "--output-file=doc-requirements.txt", "--resolver=backtracking", "--upgrade", "pyproject.toml"],
"type": "shell",
"problemMatcher": [],
"command": "uv",
"args": [
"pip", "compile",
"--extra=doc",
"--output-file=doc-requirements.txt",
"--upgrade", "pyproject.toml"
],
"presentation":
{
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"group": "requirements",
"showReuseMessage": true,
"clear": true
},
},
{
"label": "Build All Requirements",
"dependsOn": ["Build Runtime Requirements", "Build Dev Requirements", "Build Doc Requirements"]
"label": "Build All Requirements Files",
"detail": "Resolves all the dependencies into requirements files.",
"dependsOn": ["Build Runtime Requirements", "Build Dev Requirements", "Build Doc Requirements"],
"problemMatcher": [],
},
{
"label": "Install Dependencies",
"command": "pip",
"args": ["install", "-r", "requirements.txt", "-r", "doc-requirements.txt", "-r", "dev-requirements.txt"],
"detail": "Installs all the dependencies, including dev and doc extras",
"type": "shell",
"problemMatcher": [],
"command": "uv",
"args": ["sync", "--all-extras"],
"presentation":
{
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"showReuseMessage": true,
"clear": true
},
},
Expand Down
Loading