Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a2d79e1
#357 Support registration of custom requests
dhoomakethu Dec 3, 2018
f07dcee
#368 Fixes write to broadcast address
mdmuhlbaier Jan 10, 2019
2e169b6
Bump version to 2.2.0
dhoomakethu Jan 14, 2019
c410f5b
Merge branch '#357-Custom-Function' into pymodbus-2.2.0
dhoomakethu Jan 14, 2019
826240b
Fix #371 pymodbus repl on python3
dhoomakethu Jan 14, 2019
6e72e44
1. Fix tornado async serial client `TypeError` while processing incom…
dhoomakethu Jan 15, 2019
18fe036
[fix v3] poprawa sprawdzania timeout
MarekLew Jan 6, 2019
964a565
Release candidate for pymodbus 2.2.0
dhoomakethu Jan 16, 2019
6960d9c
Fix #377 when invalid port is supplied and minor updates in logging
dhoomakethu Jan 26, 2019
249ad8f
Merge remote-tracking branch 'upstream/dev' into dev
muhlbaier Jan 31, 2019
60aca50
#368 adds broadcast support for sync client and server
muhlbaier Jan 31, 2019
e07e01e
#368 Fixes minor bug in broadcast support code
muhlbaier Jan 31, 2019
5030514
Fixed erronous CRC handling
JStrbg Jan 16, 2019
1a24c1d
Merge branch 'pull/372' into pymodbus-2.2.0
dhoomakethu Feb 11, 2019
e5c2615
Update Changelog
dhoomakethu Feb 11, 2019
f66f464
Fix test coverage
dhoomakethu Feb 11, 2019
7650421
Fix #387 Transactions failing on 2.2.0rc2.
dhoomakethu Feb 16, 2019
6233706
Task Cancellation and CRC Errors
pazzarpj Dec 12, 2018
89d3909
Cherry pick commit from PR #367 , Update changelog , bump version to …
dhoomakethu Mar 6, 2019
e4f202c
#389 Support passing all serial port parameters to asynchronous server
dhoomakethu Mar 23, 2019
3f48b90
Fix BinaryPayloadDecoder and Builder wrt to coils
dhoomakethu Apr 18, 2019
c919fe4
Misc updates, bump version to 2.2.0
dhoomakethu Apr 18, 2019
3d34820
ReportSlaveIdResponse now tries to get slave id based on server ident…
dhoomakethu Apr 18, 2019
2d8d467
Update missing bcrypt requirement for testing
dhoomakethu Apr 18, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix test coverage
  • Loading branch information
dhoomakethu committed Feb 11, 2019
commit f66f464d911cc672225a62a5c89b34c817f48473
3 changes: 2 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[run]
omit =
pymodbus/repl/*
pymodbus/repl/*
pymodbus/internal/*
6 changes: 0 additions & 6 deletions pymodbus/framer/ascii_framer.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import struct
import socket
from binascii import b2a_hex, a2b_hex

from pymodbus.exceptions import ModbusIOException
from pymodbus.utilities import checkLRC, computeLRC
from pymodbus.framer import ModbusFramer, FRAME_HEADER, BYTE_ORDER

# Python 2 compatibility.
try:
TimeoutError
except NameError:
TimeoutError = socket.timeout

ASCII_FRAME_HEADER = BYTE_ORDER + FRAME_HEADER

Expand Down
29 changes: 27 additions & 2 deletions test/test_framers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,22 @@
else: # Python 2
from mock import Mock


@pytest.fixture
def rtu_framer():
return ModbusRtuFramer(ClientDecoder())


@pytest.fixture
def ascii_framer():
return ModbusAsciiFramer(ClientDecoder())


@pytest.fixture
def binary_framer():
return ModbusBinaryFramer(ClientDecoder())


@pytest.mark.parametrize("framer", [ModbusRtuFramer,
ModbusAsciiFramer,
ModbusBinaryFramer,
Expand Down Expand Up @@ -116,9 +120,12 @@ def test_populate_result(rtu_framer):
assert result.unit_id == 255


def test_process_incoming_packet(rtu_framer):
@pytest.mark.parametrize('framer', [ascii_framer, rtu_framer, binary_framer])
def test_process_incoming_packet(framer):
def cb(res):
return res
# data = b''
# framer.processIncomingPacket(data, cb, unit=1, single=False)


def test_build_packet(rtu_framer):
Expand Down Expand Up @@ -160,4 +167,22 @@ def cb(res):

def test_get_raw_frame(rtu_framer):
rtu_framer._buffer = b'\x00\x01\x00\x01\x00\n\xec\x1c'
assert rtu_framer.getRawFrame() == rtu_framer._buffer
assert rtu_framer.getRawFrame() == rtu_framer._buffer


def test_validate_unit_id(rtu_framer):
rtu_framer.populateHeader( b'\x00\x01\x00\x01\x00\n\xec\x1c')
assert rtu_framer._validate_unit_id([0], False)
assert rtu_framer._validate_unit_id([1], True)


@pytest.mark.parametrize('data', [b':010100010001FC\r\n',
b''])
def test_decode_ascii_data(ascii_framer, data):
data = ascii_framer.decode_data(data)
assert isinstance(data, dict)
if data:
assert data.get("unit") == 1
assert data.get("fcode") == 1
else:
assert not data