- 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
37 lines
1.2 KiB
Bash
37 lines
1.2 KiB
Bash
#!/bin/bash
|
||
# 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}"
|
||
|
||
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
|
||
exit 1
|
||
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
|