-
Notifications
You must be signed in to change notification settings - Fork 140
/
test_dependencies.py
44 lines (35 loc) · 1.23 KB
/
test_dependencies.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"""Extracts the dependencies of the components required for testing."""
from collections import defaultdict
from pathlib import Path
deps = defaultdict(list)
components, packages = [], []
requirements = Path("core") / "requirements_test_all.txt"
with requirements.open() as f:
lines = f.readlines()
for line in lines:
line = line.strip() # noqa: PLW2901
if line.startswith("# homeassistant."):
if components and packages:
for component in components:
deps[component].extend(packages)
components, packages = [], []
components.append(line.split("# homeassistant.")[1])
elif components and line:
packages.append(line)
# The last batch of components and packages
if components and packages:
for component in components:
deps[component].extend(packages)
required = [
"components.recorder",
"components.mqtt",
"components.zeroconf",
"components.http",
"components.stream",
"components.conversation", # only available after HA≥2023.2
"components.cloud",
"components.ffmpeg", # needed since 2024.1
]
to_install = [package for r in required for package in deps[r]]
to_install.append("flaky")
print(" ".join(to_install)) # noqa: T201