2.6 KiB
2.6 KiB
Architecture Overview
This document provides a high-level view of the framework’s components and how they interact, plus a Mermaid diagram for quick orientation.
Components
- Tests (pytest) — test modules and functions under
tests/ - Fixtures — defined in
tests/conftest.py(config, lin, flash_ecu) - Config Loader —
ecu_framework/config.py(YAML → dataclasses) - LIN Abstraction —
ecu_framework/lin/base.py(LinInterface,LinFrame) - Mock LIN Adapter —
ecu_framework/lin/mock.py - BabyLIN Adapter —
ecu_framework/lin/babylin.py(SDK wrapper → BabyLIN_library.py) - Flasher —
ecu_framework/flashing/hex_flasher.py - Power Supply (PSU) control —
ecu_framework/power/owon_psu.py(serial SCPI) - PSU tryout script —
vendor/Owon/tryout.py - Reporting Plugin —
conftest_plugin.py(docstring → report metadata) - Reports —
reports/report.html,reports/junit.xml
Mermaid architecture diagram
flowchart TB
subgraph Tests & Pytest
T[tests/*]
CF[tests/conftest.py]
PL[conftest_plugin.py]
end
subgraph Framework
CFG[ecu_framework/config.py]
BASE[ecu_framework/lin/base.py]
MOCK[ecu_framework/lin/mock.py]
BABY[ecu_framework/lin/babylin.py]
FLASH[ecu_framework/flashing/hex_flasher.py]
POWER[ecu_framework/power/owon_psu.py]
end
subgraph Artifacts
REP[reports/report.html<br/>reports/junit.xml]
YAML[config/*.yaml<br/>babylin.example.yaml<br/>test_config.yaml]
PSU_YAML[config/owon_psu.yaml<br/>OWON_PSU_CONFIG]
SDK[vendor/BabyLIN_library.py<br/>platform-specific libs]
OWON[vendor/Owon/tryout.py]
end
T --> CF
CF --> CFG
CF --> BASE
CF --> MOCK
CF --> BABY
CF --> FLASH
T --> POWER
PL --> REP
CFG --> YAML
CFG --> PSU_YAML
BABY --> SDK
T --> OWON
T --> REP
Data and control flow summary
- Tests use fixtures to obtain config and a connected LIN adapter
- Config loader reads YAML (or env override), returns typed dataclasses
- LIN calls are routed through the interface abstraction to the selected adapter
- Flasher (optional) uses the same interface to program the ECU
- Power supply control (optional) uses
ecu_framework/power/owon_psu.pyand readsconfig.power_supply(merged withconfig/owon_psu.yamlorOWON_PSU_CONFIGwhen present); the tryout script undervendor/Owon/provides a quick manual flow - Reporting plugin parses docstrings and enriches the HTML report
Extending the architecture
- Add new bus adapters by implementing
LinInterface - Add new report sinks (e.g., JSON or a DB) by extending the plugin
- Add new fixtures for diagnostics or measurement tools (Scopes, power supplies, etc.)