Skip to content

Commit 5295f7f

Browse files
committed
Align broken tests
1 parent 724da19 commit 5295f7f

2 files changed

Lines changed: 26 additions & 3 deletions

File tree

.github/workflows/update_victron_mqtt.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,38 @@ jobs:
4747
echo "update_needed=true" >> $GITHUB_OUTPUT
4848
fi
4949
50-
- name: Update manifest.json with new version
50+
- name: Update dependency pins with new version
5151
if: steps.check_update.outputs.update_needed == 'true'
5252
run: |
53+
set -e
5354
latest="${{ steps.get_release.outputs.latest_version }}"
55+
56+
# Pin integration runtime dependency.
5457
jq \
5558
--arg v "$latest" \
5659
'.requirements[0] = "victron_mqtt=="+$v' \
5760
custom_components/victron_mqtt/manifest.json > manifest.tmp && mv manifest.tmp custom_components/victron_mqtt/manifest.json
5861
62+
# Pin local/dev test dependency.
63+
sed -i -E "s|^victron_mqtt(==[0-9][0-9A-Za-z.\-]*)?$|victron_mqtt==$latest|" requirements.txt
64+
65+
# Ensure CI test job installs the same victron_mqtt version.
66+
python3 - <<'PY'
67+
from pathlib import Path
68+
import re
69+
70+
latest = "${{ steps.get_release.outputs.latest_version }}"
71+
workflow = Path(".github/workflows/validate.yaml")
72+
text = workflow.read_text(encoding="utf-8")
73+
74+
pattern = re.compile(r"(pip install [^\n]*?)victron_mqtt(?:==[^\s]+)?", re.MULTILINE)
75+
updated_text, count = pattern.subn(rf"\1victron_mqtt=={latest}", text, count=1)
76+
if count != 1:
77+
raise RuntimeError("Could not update victron_mqtt pin in .github/workflows/validate.yaml")
78+
79+
workflow.write_text(updated_text, encoding="utf-8")
80+
PY
81+
5982
- name: Download victron_mqtt release package from PyPI
6083
if: steps.check_update.outputs.update_needed == 'true'
6184
run: |

tests/snapshots/test_hub.ambr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@
244244
'max': 32,
245245
'min': 0,
246246
'mode': <NumberMode.AUTO: 'auto'>,
247-
'step': 1.0,
247+
'step': 1,
248248
}),
249249
'config_entry_id': <ANY>,
250250
'config_subentry_id': <ANY>,
@@ -288,7 +288,7 @@
288288
'max': 32,
289289
'min': 0,
290290
'mode': <NumberMode.AUTO: 'auto'>,
291-
'step': 1.0,
291+
'step': 1,
292292
}),
293293
'config_entry_id': <ANY>,
294294
'config_subentry_id': <ANY>,

0 commit comments

Comments
 (0)