Skip to content
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
18 changes: 12 additions & 6 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,11 @@ jobs:
pip install virtualenv --upgrade
python -m venv venv
. venv/bin/activate
pip install -U pip setuptools wheel
pip install -r requirements_test.txt -r requirements_commit.txt
pip install uv
uv pip install -U pip setuptools wheel
uv pip install -r requirements_test.txt -r requirements_commit.txt
# TODO: Remove after update of aiohttp beyond 3.10.0
uv pip show aiohttp | grep -q "Version: 3.10.0" && (grep -q "core.locations" venv/lib/python*/site-packages/aiohttp/web_urldispatcher.py && echo " *** aiohttp already patched" || ( echo "Patching aiohttp 3.10.0 for tests"; patch -tRup0 venv/lib/python*/site-packages/aiohttp/web_urldispatcher.py < patch/aiohttp310.patch && echo " *** aiohttp Patched!" || echo " *** aiohttp patch failed?")) || ( echo " ***"; echo " *** WE CAN REMOVE THE PATCH FOR aiohttp 3.10.0 from $0"; echo " ***" )
- name: Restore pre-commit environment from cache
id: cache-precommit
uses: actions/cache@v4
Expand Down Expand Up @@ -97,7 +100,7 @@ jobs:
- name: Ruff (with fix)
run: |
. venv/bin/activate
ruff plugwise/*py tests/*py
ruff check --fix plugwise/*py tests/*py
- name: If needed, commit ruff changes to the pull request
if: failure()
run: |
Expand Down Expand Up @@ -194,11 +197,14 @@ jobs:
run: |
python -m venv venv
. venv/bin/activate
pip install -U pip setuptools wheel
pip install uv
uv pip install -U pip setuptools wheel
#pip install -r requirements_test.txt
# 20220124 Mimic setup_test.sh
pip install --upgrade -r requirements_test.txt -c https://raw.githubusercontent.com/home-assistant/core/dev/homeassistant/package_constraints.txt -r https://raw.githubusercontent.com/home-assistant/core/dev/requirements_test.txt -r https://raw.githubusercontent.com/home-assistant/core/dev/requirements_test_pre_commit.txt
pip install --upgrade pytest-asyncio
uv pip install --upgrade -r requirements_test.txt -c https://raw.githubusercontent.com/home-assistant/core/dev/homeassistant/package_constraints.txt -r https://raw.githubusercontent.com/home-assistant/core/dev/requirements_test.txt -r https://raw.githubusercontent.com/home-assistant/core/dev/requirements_test_pre_commit.txt
uv pip install --upgrade pytest-asyncio
# TODO: Remove after update of aiohttp beyond 3.10.0
uv pip show aiohttp | grep -q "Version: 3.10.0" && (grep -q "core.locations" venv/lib/python*/site-packages/aiohttp/web_urldispatcher.py && echo " *** aiohttp already patched" || ( echo "Patching aiohttp 3.10.0 for tests"; patch -tRup0 venv/lib/python*/site-packages/aiohttp/web_urldispatcher.py < patch/aiohttp310.patch && echo " *** aiohttp Patched!" || echo " *** aiohttp patch failed?")) || ( echo " ***"; echo " *** WE CAN REMOVE THE PATCH FOR aiohttp 3.10.0 from $0"; echo " ***" )

pytest:
runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## ongoing

- Note2self; remove aiohttp 3.10 test fixing in scripts/* and verify workflow

## v0.38.3

- Implement fix for Core Issue [#119686](https://github.com/home-assistant/core/issues/119686)
Expand Down
19 changes: 19 additions & 0 deletions patch/aiohttp310.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--- venv/lib/python3.12/site-packages/aiohttp/web_urldispatcher.py 2024-08-01 13:01:32
+++ /tmp/web_urldispatcher.py 2024-08-01 22:37:19
@@ -1132,15 +1132,7 @@
def _get_resource_index_key(self, resource: AbstractResource) -> str:
"""Return a key to index the resource in the resource index."""
# strip at the first { to allow for variables
- #return resource.canonical.partition("{")[0].rstrip("/") or "/"
- if "{" in (index_key := resource.canonical):
- # strip at the first { to allow for variables, and than
- # rpartition at / to allow for variable parts in the path
- # For example if the canonical path is `/core/locations{tail:.*}`
- # the index key will be `/core` since index is based on the
- # url parts split by `/`
- index_key = index_key.partition("{")[0].rpartition("/")[0]
- return index_key.rstrip("/") or "/"
+ return resource.canonical.partition("{")[0].rstrip("/") or "/"

def index_resource(self, resource: AbstractResource) -> None:
"""Add a resource to the resource index."""
1 change: 1 addition & 0 deletions requirements_test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ radon==6.0.1
types-python-dateutil
# Added for prettier
nodeenv==1.9.1
uv
6 changes: 5 additions & 1 deletion scripts/tests_and_coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ fi
# Install/update dependencies
pre-commit install
pre-commit install-hooks
pip install -r requirements_test.txt -r requirements_commit.txt
pip install uv
uv pip install -r requirements_test.txt -r requirements_commit.txt
# TODO: Remove after update of aiohttp beyond 3.10.0
# shellcheck disable=SC2015
uv pip show aiohttp | grep -q "Version: 3.10.0" && (grep -q "core.locations" venv/lib/python*/site-packages/aiohttp/web_urldispatcher.py && echo " *** aiohttp already patched" || ( echo "Patching aiohttp 3.10.0 for tests"; patch -tRup0 venv/lib/python*/site-packages/aiohttp/web_urldispatcher.py < patch/aiohttp310.patch && echo " *** aiohttp Patched!" || echo " *** aiohttp patch failed?")) || ( echo " ***"; echo " *** WE CAN REMOVE THE PATCH FOR aiohttp 3.10.0 from $0"; echo " ***" )

set +u

Expand Down
2 changes: 1 addition & 1 deletion tests/INIT.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Once the project is ready for upload to test (i.e. version number ending in `a0`

Prepare:

- [ ] `python3 -m venv venv ; source venv/bin/activate ; pip install --upgrade pip; pip install -r requirements_test.txt ; pip install --upgrade setuptools wheel twine`
- [ ] `python3 -m venv venv ; source venv/bin/activate ; pip install --upgrade pip; pip install uv; uv pip install -r requirements_test.txt ; uv pip install --upgrade setuptools wheel twine`

Package: (**ensure you are in your venv**)

Expand Down