2021-10-25 07:17:35 +00:00
|
|
|
"""Script that checks if README.md is missing devices that have fixtures."""
|
2023-12-05 19:07:10 +00:00
|
|
|
from kasa.tests.conftest import (
|
|
|
|
ALL_DEVICES,
|
|
|
|
BULBS,
|
|
|
|
DIMMERS,
|
|
|
|
LIGHT_STRIPS,
|
|
|
|
PLUGS,
|
|
|
|
STRIPS,
|
|
|
|
)
|
2021-10-25 07:17:35 +00:00
|
|
|
|
2023-10-29 22:15:42 +00:00
|
|
|
with open("README.md") as f:
|
|
|
|
readme = f.read()
|
2021-10-25 07:17:35 +00:00
|
|
|
|
|
|
|
typemap = {
|
|
|
|
"light strips": LIGHT_STRIPS,
|
|
|
|
"bulbs": BULBS,
|
|
|
|
"plugs": PLUGS,
|
|
|
|
"strips": STRIPS,
|
|
|
|
"dimmers": DIMMERS,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def _get_device_type(dev, typemap):
|
|
|
|
for typename, devs in typemap.items():
|
|
|
|
if dev in devs:
|
|
|
|
return typename
|
|
|
|
else:
|
|
|
|
return "Unknown type"
|
|
|
|
|
|
|
|
|
|
|
|
for dev in ALL_DEVICES:
|
|
|
|
if dev not in readme:
|
|
|
|
print(f"{dev} not listed in {_get_device_type(dev, typemap)}")
|