From 06dcdbb4a484350aac8244695fd7c75abcafbaa8 Mon Sep 17 00:00:00 2001 From: Benjamin Auquite Date: Sun, 26 Mar 2023 17:04:13 -0500 Subject: [PATCH] Fix the broken tests (#467) * Update test_dependencies.py pytest reversion todo in later commit * increase verbosity for analysis * "instance" was created in the basic features PR. * Can't stand the deprecation warnings. * add testing steps to workflow action in logs. Help the next person running into this issue again. * wording in new messages. * Manifest keys should be sorted: domain, name, then alphabetical order * return basnijholt's original settings. replaced `-v` with `-qq` again in `pytest.yaml`, returned `branches: [master]` in both yaml files. * Forgot a comma * Update version in manifest to 1.6.0 * @th3w1zard1 is a code owner! * Update .gitignore * Revert "Update .gitignore" This reverts commit 172841d356173a4025f244d5a2f17a64197f7009. --- .github/workflows/hassfest.yaml | 2 +- .github/workflows/pytest.yaml | 18 ++++++++++++++---- .../adaptive_lighting/manifest.json | 10 +++++----- test_dependencies.py | 1 + tests/test_switch.py | 4 +++- 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/workflows/hassfest.yaml b/.github/workflows/hassfest.yaml index 157d5415..cc16d185 100644 --- a/.github/workflows/hassfest.yaml +++ b/.github/workflows/hassfest.yaml @@ -11,5 +11,5 @@ jobs: validate_hassfest: runs-on: "ubuntu-latest" steps: - - uses: "actions/checkout@v2" + - uses: "actions/checkout@v3.0.2" - uses: home-assistant/actions/hassfest@master diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index afa2eb21..60d9577f 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -27,12 +27,22 @@ jobs: uses: actions/setup-python@v4.1.0 with: python-version: ${{ matrix.python-version }} + - name: Click here for troubleshooting steps if tests break again. + run: | + echo "::notice::### If tests fail, try these debug steps: ###" + echo "::notice::### 1. Replace '-qq' from .github/workflow/pytest.yaml. with '-v' for extra verbosity. ###" + echo "::notice::### 2. Push or run action again. ###" + echo "::notice::### 3. Check for any log messages in github actions resembling the following using CTRL+F ### + echo "::notice::### 4. ERROR:homeassistant.setup:Setup failed for 'component': Unable to import component: No module named ''module'' ###" + echo "::notice::### 5. add 'component'.'module' (without the '') from the above log into the 'required' list inside of 'test_dependencies.py' ###" + echo "::notice::### 6. Try again! If more issues persist they should be easily solvable by reading the verbose logs now. ###" - name: Install dependencies run: | - pip install -r core/requirements.txt - pip install -r core/requirements_test.txt - pip install -e core/ - pip install $(python test_dependencies.py) + echo "::warning::### WARNING! Deprecation warnings muted with option '--use-pep517' please address this at some point in pytest.yaml. ###" + pip install -r core/requirements.txt --use-pep517 + pip install -r core/requirements_test.txt --use-pep517 + pip install -e core/ --use-pep517 + pip install $(python test_dependencies.py) --use-pep517 - name: Run pytest timeout-minutes: 60 run: | diff --git a/custom_components/adaptive_lighting/manifest.json b/custom_components/adaptive_lighting/manifest.json index d6580942..3fcd3b99 100644 --- a/custom_components/adaptive_lighting/manifest.json +++ b/custom_components/adaptive_lighting/manifest.json @@ -1,12 +1,12 @@ { "domain": "adaptive_lighting", "name": "Adaptive Lighting", - "documentation": "https://github.com/basnijholt/adaptive-lighting#readme", - "issue_tracker": "https://github.com/basnijholt/adaptive-lighting/issues", + "codeowners": ["@basnijholt", "@RubenKelevra", "@th3w1zard1"], "config_flow": true, "dependencies": [], - "codeowners": ["@basnijholt", "@RubenKelevra"], - "version": "1.4.1", + "documentation": "https://github.com/basnijholt/adaptive-lighting#readme", + "iot_class": "calculated", + "issue_tracker": "https://github.com/basnijholt/adaptive-lighting/issues", "requirements": [], - "iot_class": "calculated" + "version": "1.6.0" } diff --git a/test_dependencies.py b/test_dependencies.py index 532c88f5..a4dc0e89 100644 --- a/test_dependencies.py +++ b/test_dependencies.py @@ -24,6 +24,7 @@ required = [ "components.zeroconf", "components.http", "components.stream", + "components.conversation", ] to_install = [] for r in required: diff --git a/tests/test_switch.py b/tests/test_switch.py index 59c9245d..321894cf 100644 --- a/tests/test_switch.py +++ b/tests/test_switch.py @@ -223,7 +223,9 @@ async def test_adaptive_lighting_switches(hass): assert ADAPT_COLOR_SWITCH in data assert ADAPT_BRIGHTNESS_SWITCH in data assert UNDO_UPDATE_LISTENER in data - assert len(data.keys()) == 5 + assert "instance" in data + + assert len(data.keys()) == 6 @pytest.mark.parametrize("lat,long,timezone", LAT_LONG_TZS)