Skip to content

Commit 2a9dcd5

Browse files
committed
Rerun fixtures to test userdata
1 parent 40ea0e2 commit 2a9dcd5

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ repos:
8282
- id: markdownlint
8383
- repo: local
8484
hooks:
85+
- id: parsetest
86+
name: "parsetest"
87+
entry: script/run-in-env.sh python script/generate_ha_fixture.py
88+
language: script
89+
types: [python]
90+
pass_filenames: false
8591
- id: pytest
8692
name: "pytest"
8793
entry: script/run-in-env.sh pytest

script/mashumaro-step-debug.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
if _project_root_dir not in sys.path:
1313
sys.path.append(_project_root_dir)
1414

15+
from airos.airos8 import AirOS # noqa: E402
1516
from airos.data import AirOS8Data, Interface, Remote, Station, Wireless # noqa: E402
1617

1718
logging.basicConfig(level=logging.DEBUG, stream=sys.stdout)
@@ -71,14 +72,17 @@ def main() -> None:
7172
interface_obj = Interface.from_dict(interface_data) # noqa: F841
7273
_LOGGER.info(" Success! Interface is valid.")
7374

75+
_LOGGER.info("Deriving AirOS8Data from object...")
76+
derived_data = AirOS.derived_data(None, data) # type: ignore[arg-type]
77+
7478
_LOGGER.info("Attempting to deserialize full AirOS8Data object...")
75-
airos_data_obj = AirOS8Data.from_dict(data) # noqa: F841
79+
airos_data_obj = AirOS8Data.from_dict(derived_data) # noqa: F841
7680
_LOGGER.info("Success! Full AirOS8Data object is valid.")
7781

78-
except Exception as e:
82+
except Exception:
7983
_LOGGER.info("\n------------------")
8084
_LOGGER.info("CRITICAL ERROR FOUND!")
81-
_LOGGER.info("The program failed at: %s", e)
85+
_LOGGER.exception("The program failed")
8286
_LOGGER.info("------------------\n")
8387

8488

0 commit comments

Comments
 (0)