FIXUP! rename the tryout script to quick demo

This commit is contained in:
Hosam-Eldin.mostafa 2025-10-24 23:56:47 +02:00
parent 0a18d03d4f
commit 528ab239dc
10 changed files with 25 additions and 25 deletions

View File

@ -151,7 +151,7 @@ ecu_tests/
│ └── owon_psu.yaml # Optional machine-specific PSU config │ └── owon_psu.yaml # Optional machine-specific PSU config
├── vendor/ # Place SDK wrapper and platform libs here ├── vendor/ # Place SDK wrapper and platform libs here
│ ├── Owon/ │ ├── Owon/
│ │ └── tryout.py # Quick PSU demo using the library & YAML │ │ └── owon_psu_quick_demo.py # Quick PSU demo using the library & YAML
│ ├── BabyLIN_library.py # Official SDK Python wrapper │ ├── BabyLIN_library.py # Official SDK Python wrapper
│ └── BabyLIN library/ # Platform-specific binaries from SDK (DLL/.so) │ └── BabyLIN library/ # Platform-specific binaries from SDK (DLL/.so)
├── reports/ # Generated reports ├── reports/ # Generated reports
@ -221,16 +221,16 @@ The `ecu_framework/lin/babylin.py` implementation uses the official `BabyLIN_lib
- Permission errors in PowerShell: run the venv's full Python path or adjust ExecutionPolicy for scripts. - Permission errors in PowerShell: run the venv's full Python path or adjust ExecutionPolicy for scripts.
- Import errors: activate the venv and reinstall `requirements.txt`. - Import errors: activate the venv and reinstall `requirements.txt`.
## Owon Power Supply (SCPI) — library, config, tests, and tryout ## Owon Power Supply (SCPI) — library, config, tests, and quick demo
We provide a reusable pyserial-based library, a hardware test integrated with the central config, We provide a reusable pyserial-based library, a hardware test integrated with the central config,
and a minimal tryout script. and a minimal quick demo script.
- Library: `ecu_framework/power/owon_psu.py` (class `OwonPSU`, `SerialParams`, `scan_ports`) - Library: `ecu_framework/power/owon_psu.py` (class `OwonPSU`, `SerialParams`, `scan_ports`)
- Central config: `config/test_config.yaml` (`power_supply` section) - Central config: `config/test_config.yaml` (`power_supply` section)
- Optionally merge `config/owon_psu.yaml` or set `OWON_PSU_CONFIG` to a YAML path - Optionally merge `config/owon_psu.yaml` or set `OWON_PSU_CONFIG` to a YAML path
- Hardware test: `tests/hardware/test_owon_psu.py` (skips unless `power_supply.enabled` is true) - Hardware test: `tests/hardware/test_owon_psu.py` (skips unless `power_supply.enabled` is true)
- Tryout: `vendor/Owon/tryout.py` (reads `OWON_PSU_CONFIG` or `config/owon_psu.yaml`) - quick demo: `vendor/Owon/owon_psu_quick_demo.py` (reads `OWON_PSU_CONFIG` or `config/owon_psu.yaml`)
Quick setup (Windows PowerShell): Quick setup (Windows PowerShell):
@ -250,8 +250,8 @@ copy .\config\owon_psu.example.yaml .\config\owon_psu.yaml
# Run the hardware PSU test (skips if disabled or missing port) # Run the hardware PSU test (skips if disabled or missing port)
pytest -k test_owon_psu_idn_and_optional_set -m hardware -q pytest -k test_owon_psu_idn_and_optional_set -m hardware -q
# Run the tryout script # Run the quick demo script
python .\vendor\Owon\tryout.py python .\vendor\Owon\owon_psu_quick_demo.py
``` ```
YAML keys supported by `power_supply`: YAML keys supported by `power_supply`:

View File

@ -314,7 +314,7 @@ The framework includes a serial SCPI controller for Owon PSUs and a hardware tes
- Config: `config/test_config.yaml` (`power_supply` section) - Config: `config/test_config.yaml` (`power_supply` section)
- Optionally merge machine-specific settings from `config/owon_psu.yaml` or env `OWON_PSU_CONFIG` - Optionally merge machine-specific settings from `config/owon_psu.yaml` or env `OWON_PSU_CONFIG`
- Hardware test: `tests/hardware/test_owon_psu.py` (skips unless `power_supply.enabled` and `port` present) - Hardware test: `tests/hardware/test_owon_psu.py` (skips unless `power_supply.enabled` and `port` present)
- Tryout: `vendor/Owon/tryout.py` - quick demo: `vendor/Owon/owon_psu_quickdemo.py`
Quick run: Quick run:
@ -323,7 +323,7 @@ pip install -r .\requirements.txt
copy .\config\owon_psu.example.yaml .\config\owon_psu.yaml copy .\config\owon_psu.example.yaml .\config\owon_psu.yaml
# edit COM port in .\config\owon_psu.yaml # edit COM port in .\config\owon_psu.yaml
pytest -k test_owon_psu_idn_and_optional_set -m hardware -q pytest -k test_owon_psu_idn_and_optional_set -m hardware -q
python .\vendor\Owon\tryout.py python .\vendor\Owon\owon_psu_quick_demo.py
``` ```
Common config keys: Common config keys:

View File

@ -47,7 +47,7 @@ sequenceDiagram
X-->>F: Flash result (ok/fail) X-->>F: Flash result (ok/fail)
end end
opt power_supply.enabled and port provided opt power_supply.enabled and port provided
Note over PS: Tests/tryouts may open PSU via ecu_framework.power.owon_psu Note over PS: owon_psu_quick_demo may open PSU via ecu_framework.power.owon_psu
end end
loop for each test loop for each test
P->>PL: runtest_makereport(item, call) P->>PL: runtest_makereport(item, call)

View File

@ -112,7 +112,7 @@ central defaults in `config/test_config.yaml`.
- PSU-related tests or utilities read `config.power_supply` for serial parameters - PSU-related tests or utilities read `config.power_supply` for serial parameters
and optional actions (IDN assertions, on/off toggle, set/measure). The reference and optional actions (IDN assertions, on/off toggle, set/measure). The reference
implementation is `ecu_framework/power/owon_psu.py`, with a hardware test in implementation is `ecu_framework/power/owon_psu.py`, with a hardware test in
`tests/hardware/test_owon_psu.py` and a tryout script in `vendor/Owon/tryout.py`. `tests/hardware/test_owon_psu.py` and a quick demo script in `vendor/Owon/owon_psu_quick_demo.py`.
## Tips ## Tips

View File

@ -12,7 +12,7 @@ This document provides a high-level view of the frameworks components and how
- BabyLIN Adapter — `ecu_framework/lin/babylin.py` (SDK wrapper → BabyLIN_library.py) - BabyLIN Adapter — `ecu_framework/lin/babylin.py` (SDK wrapper → BabyLIN_library.py)
- Flasher — `ecu_framework/flashing/hex_flasher.py` - Flasher — `ecu_framework/flashing/hex_flasher.py`
- Power Supply (PSU) control — `ecu_framework/power/owon_psu.py` (serial SCPI) - Power Supply (PSU) control — `ecu_framework/power/owon_psu.py` (serial SCPI)
- PSU tryout script — `vendor/Owon/tryout.py` - PSU quick demo script — `vendor/Owon/owon_psu_quick_demo.py`
- Reporting Plugin — `conftest_plugin.py` (docstring → report metadata) - Reporting Plugin — `conftest_plugin.py` (docstring → report metadata)
- Reports — `reports/report.html`, `reports/junit.xml` - Reports — `reports/report.html`, `reports/junit.xml`
@ -40,7 +40,7 @@ flowchart TB
YAML[config/*.yaml<br/>babylin.example.yaml<br/>test_config.yaml] YAML[config/*.yaml<br/>babylin.example.yaml<br/>test_config.yaml]
PSU_YAML[config/owon_psu.yaml<br/>OWON_PSU_CONFIG] PSU_YAML[config/owon_psu.yaml<br/>OWON_PSU_CONFIG]
SDK[vendor/BabyLIN_library.py<br/>platform-specific libs] SDK[vendor/BabyLIN_library.py<br/>platform-specific libs]
OWON[vendor/Owon/tryout.py] OWON[vendor/Owon/owon_psu_quick_demo.py]
end end
T --> CF T --> CF
@ -67,7 +67,7 @@ flowchart TB
- Flasher (optional) uses the same interface to program the ECU - Flasher (optional) uses the same interface to program the ECU
- Power supply control (optional) uses `ecu_framework/power/owon_psu.py` and reads - Power supply control (optional) uses `ecu_framework/power/owon_psu.py` and reads
`config.power_supply` (merged with `config/owon_psu.yaml` or `OWON_PSU_CONFIG` when present); `config.power_supply` (merged with `config/owon_psu.yaml` or `OWON_PSU_CONFIG` when present);
the tryout script under `vendor/Owon/` provides a quick manual flow the quick demo script under `vendor/Owon/` provides a quick manual flow
- Reporting plugin parses docstrings and enriches the HTML report - Reporting plugin parses docstrings and enriches the HTML report
## Extending the architecture ## Extending the architecture

View File

@ -175,14 +175,14 @@ Running tests headless via systemd typically involves:
## Power supply (Owon) hardware test ## Power supply (Owon) hardware test
Enable `power_supply` in your config and set the serial port, then run the dedicated test or the tryout script. Enable `power_supply` in your config and set the serial port, then run the dedicated test or the quick demo script.
```powershell ```powershell
copy .\config\owon_psu.example.yaml .\config\owon_psu.yaml copy .\config\owon_psu.example.yaml .\config\owon_psu.yaml
# edit COM port in .\config\owon_psu.yaml or set values in config\test_config.yaml # edit COM port in .\config\owon_psu.yaml or set values in config\test_config.yaml
pytest -k test_owon_psu_idn_and_optional_set -m hardware -q pytest -k test_owon_psu_idn_and_optional_set -m hardware -q
python .\vendor\Owon\tryout.py python .\vendor\Owon\owon_psu_quick_demo.py
``` ```
See also: `docs/14_power_supply.md` for details and troubleshooting. See also: `docs/14_power_supply.md` for details and troubleshooting.

View File

@ -1,10 +1,10 @@
# Power Supply (Owon) — control, configuration, tests, and tryout # Power Supply (Owon) — control, configuration, tests, and quick demo
This guide covers using the Owon bench power supply via SCPI over serial with the framework. This guide covers using the Owon bench power supply via SCPI over serial with the framework.
- Library: `ecu_framework/power/owon_psu.py` - Library: `ecu_framework/power/owon_psu.py`
- Hardware test: `tests/hardware/test_owon_psu.py` - Hardware test: `tests/hardware/test_owon_psu.py`
- Tryout script: `vendor/Owon/tryout.py` - quick demo script: `vendor/Owon/owon_psu_quick_demo.py`
- Configuration: `config/test_config.yaml` (`power_supply`), optionally merged from `config/owon_psu.yaml` or env `OWON_PSU_CONFIG` - Configuration: `config/test_config.yaml` (`power_supply`), optionally merged from `config/owon_psu.yaml` or env `OWON_PSU_CONFIG`
## Install dependencies ## Install dependencies
@ -74,12 +74,12 @@ Notes:
- Commands use newline-terminated writes; reads use `readline()` - Commands use newline-terminated writes; reads use `readline()`
- SCPI forms: `SOUR:VOLT`, `SOUR:CURR`, `MEAS:VOLT?`, `MEAS:CURR?`, `output 0/1`, `output?` - SCPI forms: `SOUR:VOLT`, `SOUR:CURR`, `MEAS:VOLT?`, `MEAS:CURR?`, `output 0/1`, `output?`
## Tryout script ## quick demo script
The tryout reads `OWON_PSU_CONFIG` or `config/owon_psu.yaml` and performs a small sequence. The quick demo reads `OWON_PSU_CONFIG` or `config/owon_psu.yaml` and performs a small sequence.
```powershell ```powershell
python .\vendor\Owon\tryout.py python .\vendor\Owon\owon_psu_quick_demo.py
``` ```
It also scans ports with `*IDN?` using `scan_ports()`. It also scans ports with `*IDN?` using `scan_ports()`.
@ -99,5 +99,5 @@ It also scans ports with `*IDN?` using `scan_ports()`.
- `ecu_framework/power/owon_psu.py` — PSU controller (pyserial) - `ecu_framework/power/owon_psu.py` — PSU controller (pyserial)
- `tests/hardware/test_owon_psu.py` — Hardware test using central config - `tests/hardware/test_owon_psu.py` — Hardware test using central config
- `vendor/Owon/tryout.py` — Quick demo runner - `vendor/Owon/owon_psu_quick_demo.py` — Quick demo runner
- `config/owon_psu.example.yaml` — Example machine-specific YAML - `config/owon_psu.example.yaml` — Example machine-specific YAML

View File

@ -16,11 +16,11 @@ A guided tour of the ECU testing framework. Start here:
11. `10_build_custom_image.md` — Build a custom Raspberry Pi OS image with the framework baked in 11. `10_build_custom_image.md` — Build a custom Raspberry Pi OS image with the framework baked in
12. `12_using_the_framework.md` — Practical usage: local, hardware, CI, and Pi 12. `12_using_the_framework.md` — Practical usage: local, hardware, CI, and Pi
13. `13_unit_testing_guide.md` — Unit tests layout, markers, coverage, and tips 13. `13_unit_testing_guide.md` — Unit tests layout, markers, coverage, and tips
14. `14_power_supply.md` — Owon PSU control, configuration, tests, and tryout script 14. `14_power_supply.md` — Owon PSU control, configuration, tests, and quick demo script
15. `15_report_properties_cheatsheet.md` — Standardized keys for record_property/rp across suites 15. `15_report_properties_cheatsheet.md` — Standardized keys for record_property/rp across suites
Related references: Related references:
- Root project guide: `../README.md` - Root project guide: `../README.md`
- Full framework guide: `../TESTING_FRAMEWORK_GUIDE.md` - Full framework guide: `../TESTING_FRAMEWORK_GUIDE.md`
- BabyLIN placement and integration: `../vendor/README.md` - BabyLIN placement and integration: `../vendor/README.md`
- PSU tryout and scripts: `../vendor/Owon/` - PSU quick demo and scripts: `../vendor/Owon/`

View File

@ -6,7 +6,7 @@ This module provides a small, programmatic API suitable for tests:
- scan_ports(): find devices responding to *IDN? - scan_ports(): find devices responding to *IDN?
- auto_detect(): select the first matching device by IDN substring - auto_detect(): select the first matching device by IDN substring
Behavior follows the working tryout example (serial): Behavior follows the working quick demo example (serial):
- Both commands and queries are terminated with a newline ("\n" by default). - Both commands and queries are terminated with a newline ("\n" by default).
- Queries use readline() to fetch a single-line response. - Queries use readline() to fetch a single-line response.
- Command set uses: 'output 0/1', 'output?', 'SOUR:VOLT <V>', 'SOUR:CURR <A>', 'MEAS:VOLT?', 'MEAS:CURR?', '*IDN?' - Command set uses: 'output 0/1', 'output?', 'SOUR:VOLT <V>', 'SOUR:CURR <A>', 'MEAS:VOLT?', 'MEAS:CURR?', '*IDN?'

View File

@ -83,7 +83,7 @@ def run_demo() -> int:
time.sleep(0.5) time.sleep(0.5)
psu.set_voltage(1, set_v) psu.set_voltage(1, set_v)
psu.set_current(1, set_i) psu.set_current(1, set_i)
time.sleep(0.5) time.sleep(1.0)
print(f"Measured V: {psu.measure_voltage()} V") print(f"Measured V: {psu.measure_voltage()} V")
print(f"Measured I: {psu.measure_current()} A") print(f"Measured I: {psu.measure_current()} A")
time.sleep(0.5) time.sleep(0.5)