ha(H2): компонент fglair — manifest, config flow (облако/ручной/импорт), пробная сессия
- custom_components/fglair: manifest (config_flow, local_push, requirements),
const, trial (start -> ONLINE <=10 c -> GET базовых свойств), FglairClient
(сессия pyfglair в executor, колбэки в loop, --runtime_data),
__init__ (setup/unload, рефкаунт глобального лог-пампа)
- config flow: меню cloud/manual/import_json + import-source; discover через
pyfglair.provision; пробное подключение с диагностикой (cannot_connect,
no_slots, key_mismatch, timeout, invalid_auth, invalid_import); unique_id=dsn
- strings.json + translations/{en,ru}.json
- тесты HA (pytest-homeassistant-custom-component): меню/шаги/ошибки/импорт/
облако (discover замокан), setup/unload, занятый порт; trial против
mock_ac.py (online/key_mismatch/unreachable/no_slots)
- pytest.ini (общий), tests/conftest перенесён на уровень tests/,
scripts/py-ci.sh: --setup-ha и прогон tests/components
This commit is contained in:
+23
-8
@@ -1,17 +1,26 @@
|
||||
#!/bin/bash
|
||||
# CI python-части репозитория (pyfglair; позже — тесты HA-компонента).
|
||||
# scripts/py-ci.sh --setup # создать venv и поставить зависимости
|
||||
# scripts/py-ci.sh # прогнать pytest (ядро соберётся в conftest)
|
||||
# CI python-части репозитория: pyfglair + HA-компонент.
|
||||
# scripts/py-ci.sh --setup # venv для pyfglair-тестов
|
||||
# scripts/py-ci.sh --setup-ha # venv с homeassistant/pytest-плагином (тяжёлый)
|
||||
# scripts/py-ci.sh # pytest: tests/pyfglair + tests/components (если есть venv)
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
VENV="${PY_VENV:-.venv}"
|
||||
HA_VENV="${HA_VENV:-.venv-ha}"
|
||||
|
||||
if [ "${1:-}" = "--setup" ]; then
|
||||
python3 -m venv "$VENV"
|
||||
"$VENV/bin/pip" install -q --upgrade pip
|
||||
"$VENV/bin/pip" install -q cffi aiohttp pytest pytest-asyncio
|
||||
fi
|
||||
case "${1:-}" in
|
||||
--setup)
|
||||
python3 -m venv "$VENV"
|
||||
"$VENV/bin/pip" install -q --upgrade pip
|
||||
"$VENV/bin/pip" install -q cffi aiohttp pytest pytest-asyncio
|
||||
;;
|
||||
--setup-ha)
|
||||
python3 -m venv "$HA_VENV"
|
||||
"$HA_VENV/bin/pip" install -q --upgrade pip
|
||||
"$HA_VENV/bin/pip" install -q -r tests/components/requirements.txt
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ ! -x "$VENV/bin/python" ]; then
|
||||
echo "py-ci: нет $VENV (запустите: scripts/py-ci.sh --setup)" >&2
|
||||
@@ -19,3 +28,9 @@ if [ ! -x "$VENV/bin/python" ]; then
|
||||
fi
|
||||
|
||||
"$VENV/bin/python" -m pytest tests/pyfglair -q
|
||||
|
||||
if [ -x "$HA_VENV/bin/python" ]; then
|
||||
"$HA_VENV/bin/python" -m pytest tests/components -q
|
||||
else
|
||||
echo "py-ci: нет $HA_VENV — HA-тесты пропущены (scripts/py-ci.sh --setup-ha)"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user