Refactor: rename SimDUT, restructure DUT simulation and test flow

This commit is contained in:
2025-07-21 15:57:15 -06:00
parent 27064417dd
commit 4a1f943126
28 changed files with 750 additions and 5 deletions

View File

@@ -0,0 +1,20 @@
# tests/test_power_supply.py
"""
Basic functional tests for the PowerSupply
"""
def test_set_and_measure_voltage(power_supply):
test_voltage = 5.0
power_supply.set_voltage(test_voltage)
measured = power_supply.measure_voltage()
assert abs(measured - test_voltage) < 0.05
def test_output_toggle(power_supply):
power_supply.enable_output(True)
# Only works for DummyBackend which keeps state
if hasattr(power_supply.comm, "state"):
assert power_supply.comm.state["OUTP"] is True
power_supply.enable_output(False)
if hasattr(power_supply.comm, "state"):
assert power_supply.comm.state["OUTP"] is False