Skip to content

Commit

Permalink
Merge pull request #1241 from Bastian-Krause/bst/test_modbusrtudriver…
Browse files Browse the repository at this point in the history
…_2.1

tests/test_modbusrtudriver: mock serial instead of relying on port=None
  • Loading branch information
Emantor committed Jul 20, 2023
2 parents 39c2b0f + 352191f commit 58ba833
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions tests/test_modbusrtudriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,11 @@ def test_resource_with_non_default_argument(target):

def test_driver(target, mocker):
pytest.importorskip("minimalmodbus")
mocker.patch('serial.Serial')

ModbusRTU(target, name=None, port="/dev/tty0", address=10)
driver = ModbusRTUDriver(target, name=None)

# Ensure pyserial will not try to open the port
driver.resource.port = None

target.activate(driver)

assert driver.instrument.serial.baudrate == 115200
Expand Down

0 comments on commit 58ba833

Please sign in to comment.