Skip to content

Commit 6b1f9b3

Browse files
committed
refactor: ensure deterministic test data loading by sorting file globs and remove redundant snapshot comment
1 parent aa8de5e commit 6b1f9b3

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

tests/mock_data.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,12 @@
126126

127127
TESTDATA = pathlib.Path("tests/testdata")
128128

129-
PRODUCTS = {file.name: json.load(file.open(encoding="utf-8")) for file in TESTDATA.glob("home_data_product_*.json")}
130-
DEVICES = {file.name: json.load(file.open(encoding="utf-8")) for file in TESTDATA.glob("home_data_device_*.json")}
129+
PRODUCTS = {
130+
file.name: json.load(file.open(encoding="utf-8")) for file in sorted(TESTDATA.glob("home_data_product_*.json"))
131+
}
132+
DEVICES = {
133+
file.name: json.load(file.open(encoding="utf-8")) for file in sorted(TESTDATA.glob("home_data_device_*.json"))
134+
}
131135

132136
# Products
133137
A27_PRODUCT_DATA = PRODUCTS["home_data_product_a27.json"]

tests/test_supported_features.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,5 @@ def test_device_features_from_home_data(
101101
feature_info=[],
102102
product_nickname=product.product_nickname,
103103
)
104-
# Snapshot all boolean features as a sorted dict for stable output
105104
feature_dict = {k: v for k, v in asdict(device_features).items() if isinstance(v, bool)}
106105
assert feature_dict == snapshot

0 commit comments

Comments
 (0)