From 648a5e93fdfaa2c9b519b5bd19ad45e53d9a54c4 Mon Sep 17 00:00:00 2001 From: Manuel Liebert Date: Tue, 17 Dec 2024 12:03:54 +0100 Subject: [PATCH] Specify requirements versions and adapt to non positional arguments --- software/hwio-raspberry/requirements.txt | 2 +- software/hwio-virtual/requirements.txt | 2 +- tests/requirements.txt | 14 +++++++------- tests/test_modbus.py | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/software/hwio-raspberry/requirements.txt b/software/hwio-raspberry/requirements.txt index d587dca..c4cafe8 100644 --- a/software/hwio-raspberry/requirements.txt +++ b/software/hwio-raspberry/requirements.txt @@ -1,4 +1,4 @@ -pymodbus +pymodbus==3.7.4 smbus nmcli RPi.GPIO diff --git a/software/hwio-virtual/requirements.txt b/software/hwio-virtual/requirements.txt index ac7086b..16bc330 100644 --- a/software/hwio-virtual/requirements.txt +++ b/software/hwio-virtual/requirements.txt @@ -1,2 +1,2 @@ -pymodbus +pymodbus==3.7.4 nicegui diff --git a/tests/requirements.txt b/tests/requirements.txt index 2a921c5..1cdef6c 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,7 +1,7 @@ -pytest -pytest-cov -pytest-asyncio -pymodbus -asyncio -asyncua -requests \ No newline at end of file +pytest==8.3.4 +pytest-cov==6.0.0 +pytest-asyncio==0.25.0 +pymodbus==3.7.4 +asyncio==3.4.3 +asyncua==1.1.0 +requests==2.25.1 diff --git a/tests/test_modbus.py b/tests/test_modbus.py index 4c519bc..fef027c 100644 --- a/tests/test_modbus.py +++ b/tests/test_modbus.py @@ -51,7 +51,7 @@ def test_read_holding_register(modbus_client): """ # Address of the register (Modbus address is often 0-based) register_address = 1 - result = modbus_client.read_holding_registers(register_address, 1) + result = modbus_client.read_holding_registers(register_address, count=1) # Check if we received a valid response assert result is not None, "No response from the Modbus server" @@ -73,7 +73,7 @@ def test_write_single_register(modbus_client): assert not result.isError(), f"Modbus error: {result}" # Verify that the value was written correctly by reading it back - read_result = modbus_client.read_holding_registers(register_address, 1) + read_result = modbus_client.read_holding_registers(register_address, count=1) assert read_result.registers[0] == value_to_write, f"Expected {value_to_write}, got {read_result.registers[0]}" @pytest.mark.asyncio