hitl_tester.test_cases.bms.test_bms_hw

Perform a quick test on the BMS hardware API.

 1"""
 2Perform a quick test on the BMS hardware API.
 3"""
 4
 5import pytest
 6
 7from hitl_tester.modules.bms.bms_hw import BMSHardware
 8from hitl_tester.modules.bms_types import DischargeType, NiCdChargeCycle, BatteryType
 9from hitl_tester.modules.logger import logger
10
11bms_hardware = BMSHardware(pytest.flags)  # type: ignore[arg-type]
12bms_hardware.init()
13
14
15def test_setup_1():
16    """Test various attributes."""
17    # Setup the battery type
18    bms_hardware.battery_type = BatteryType.NICD
19    assert bms_hardware.battery_type == BatteryType.NICD
20
21    # Setup the charge Type
22    bms_hardware.nicd_charge_type = NiCdChargeCycle.STANDARD
23    assert bms_hardware.nicd_charge_type == NiCdChargeCycle.STANDARD
24
25    # Setup the discharge type
26    bms_hardware.discharge_type = DischargeType.CONSTANT_CURRENT
27    assert bms_hardware.discharge_type == DischargeType.CONSTANT_CURRENT
28
29    # Setup the battery capacity
30    bms_hardware.total_ah = 10
31    assert bms_hardware.total_ah == 10
32
33    bms_hardware.discharge_type = DischargeType.CONSTANT_CURRENT
34    assert bms_hardware.discharge_type == DischargeType.CONSTANT_CURRENT
35
36    bms_hardware.current = 25
37    assert bms_hardware.current == 25
38
39    # Write to the report file
40    logger.write_result_to_report("test_setup_1: PASS")
def test_setup_1():
16def test_setup_1():
17    """Test various attributes."""
18    # Setup the battery type
19    bms_hardware.battery_type = BatteryType.NICD
20    assert bms_hardware.battery_type == BatteryType.NICD
21
22    # Setup the charge Type
23    bms_hardware.nicd_charge_type = NiCdChargeCycle.STANDARD
24    assert bms_hardware.nicd_charge_type == NiCdChargeCycle.STANDARD
25
26    # Setup the discharge type
27    bms_hardware.discharge_type = DischargeType.CONSTANT_CURRENT
28    assert bms_hardware.discharge_type == DischargeType.CONSTANT_CURRENT
29
30    # Setup the battery capacity
31    bms_hardware.total_ah = 10
32    assert bms_hardware.total_ah == 10
33
34    bms_hardware.discharge_type = DischargeType.CONSTANT_CURRENT
35    assert bms_hardware.discharge_type == DischargeType.CONSTANT_CURRENT
36
37    bms_hardware.current = 25
38    assert bms_hardware.current == 25
39
40    # Write to the report file
41    logger.write_result_to_report("test_setup_1: PASS")

Test various attributes.