From 72908c2cd8846997ae560bda688bd0a9f6c05fe3 Mon Sep 17 00:00:00 2001 From: Dermot Duffy Date: Mon, 21 Oct 2024 22:11:49 -0700 Subject: [PATCH 1/2] Add CI --- .github/workflows/{validate.yml => ci.yml} | 30 +++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) rename .github/workflows/{validate.yml => ci.yml} (57%) diff --git a/.github/workflows/validate.yml b/.github/workflows/ci.yml similarity index 57% rename from .github/workflows/validate.yml rename to .github/workflows/ci.yml index 7a2c6a1..d9d65a1 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/ci.yml @@ -1,9 +1,7 @@ -name: "Validate" +name: "CI" on: workflow_dispatch: - schedule: - - cron: "0 0 * * *" push: branches: - "main" @@ -11,6 +9,9 @@ on: branches: - "main" +env: + DEFAULT_PYTHON: "3.12" + jobs: hassfest: # https://developers.home-assistant.io/blog/2020/04/16/hassfest name: "Hassfest Validation" @@ -35,3 +36,26 @@ jobs: category: "integration" # Remove this 'ignore' key when you have added brand images for your integration to https://github.com/home-assistant/brands ignore: "brands" + + tests: + runs-on: "ubuntu-latest" + name: Run tests + steps: + - name: Check out code from GitHub + uses: "actions/checkout@v4.2.1" + - name: Setup Python ${{ env.DEFAULT_PYTHON }} + uses: "actions/setup-python@v5.1.1" + with: + python-version: ${{ env.DEFAULT_PYTHON }} + - name: Install requirements + run: | + pip install pip + pip install -r requirements_test.txt + - name: Tests suite + run: | + pytest -p no:sugar + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4.5.0 + with: + env_vars: OS,PYTHON + verbose: true From 1502ad45e10f775d930c7d71b7def6e307cd5aaf Mon Sep 17 00:00:00 2001 From: Dermot Duffy Date: Mon, 21 Oct 2024 22:20:34 -0700 Subject: [PATCH 2/2] Try re-arranging the order --- tests/test_proxy_lib.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_proxy_lib.py b/tests/test_proxy_lib.py index 6e5b766..8841651 100644 --- a/tests/test_proxy_lib.py +++ b/tests/test_proxy_lib.py @@ -201,10 +201,10 @@ async def test_headers( hass_client_no_auth: Any, ) -> None: """Test proxy headers are added and respected.""" - unauthenticated_hass_client = await hass_client_no_auth() - await register_test_view(hass, proxied_url=ProxiedURL(url=f"{local_server}ok")) + unauthenticated_hass_client = await hass_client_no_auth() + resp = await unauthenticated_hass_client.get( TEST_PROXY_URL, headers={hdrs.CONTENT_ENCODING: "foo"},