Skip to content

Commit d7834ac

Browse files
committed
Merge branch 'dev' to define v3.0.0
2 parents 5f14caa + ca3d0da commit d7834ac

40 files changed

+92
-389
lines changed

CHANGELOG.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
version 3.0.0
2+
----------------------------------------------------------
3+
* Solve multiple incomming frames. (#1107)
4+
* Up coverage, tests are 100%. (#1098)
5+
* Prepare for rc1. (#1097)
6+
* Prepare 3.0.0dev5 (#1095)
7+
* Adapt serial tests. (#1094)
8+
* Allow windows. (#1093)
9+
110
version 3.0.0dev5
211
----------------------------------------------------------
312
* Remove server sync code and combine with async code. (#1092)

README.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Supported versions
1919

2020
Version `2.5.3 <https://github.com/riptideio/pymodbus/releases/tag/v2.5.3>`_ is the last 2.x release (Supports python 2.7.x - 3.7).
2121

22-
Version `3.0.0dev5 <https://github.com/riptideio/pymodbus/releases/tag/v3.0.0dev5>`_ is the current prerelease of 3.0.0 (Supports Python >=3.8).
22+
Version `3.0.0 <https://github.com/riptideio/pymodbus/releases/tag/v3.0.0>`_ is the latest release of 3.0.0 (Supports Python >=3.8).
2323

2424
Remark: "Supports" means that we only test with those versions, lower versions (e.g. 3.7) might work depending on the functionality used.
2525

@@ -135,6 +135,8 @@ If you think, that something in the code is broken/not running well, please `ope
135135
Pymodbus REPL (Read Evaluate Print Loop)
136136
------------------------------------------------------------
137137

138+
**Warning** The Pymodbus REPL documentation is not updated.
139+
138140
~~~~~~~~~~~~~~~~~~~~~
139141
Pymodbus REPL Client
140142
~~~~~~~~~~~~~~~~~~~~~

pymodbus/exceptions.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,6 @@ def __init__(self, string=""):
106106
ModbusException.__init__(self, message)
107107

108108

109-
class TimeOutException(ModbusException):
110-
"""Error resulting from modbus response timeout."""
111-
112-
def __init__(self, string=""):
113-
"""Initialize the exception.
114-
115-
:param string: The message to append to the error
116-
"""
117-
message = f"[Timeout] {string}"
118-
ModbusException.__init__(self, message)
119-
120-
121109
# --------------------------------------------------------------------------- #
122110
# Exported symbols
123111
# --------------------------------------------------------------------------- #
@@ -130,5 +118,4 @@ def __init__(self, string=""):
130118
"NoSuchSlaveException",
131119
"InvalidMessageReceivedException",
132120
"MessageRegisterException",
133-
"TimeOutException",
134121
]

pymodbus/framer/rtu_framer.py

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -232,21 +232,25 @@ def processIncomingPacket(
232232
unit = [unit]
233233
self.addToFrame(data)
234234
single = kwargs.get("single", False)
235-
if self.isFrameReady():
236-
if self.checkFrame():
237-
if self._validate_unit_id(unit, single):
238-
self._process(callback)
235+
while True:
236+
if self.isFrameReady():
237+
if self.checkFrame():
238+
if self._validate_unit_id(unit, single):
239+
self._process(callback)
240+
else:
241+
header_txt = self._header["uid"]
242+
txt = f"Not a valid unit id - {header_txt}, ignoring!!"
243+
_logger.debug(txt)
244+
self.resetFrame()
245+
break
239246
else:
240-
header_txt = self._header["uid"]
241-
txt = f"Not a valid unit id - {header_txt}, ignoring!!"
242-
_logger.debug(txt)
247+
_logger.debug("Frame check failed, ignoring!!")
243248
self.resetFrame()
249+
break
244250
else:
245-
_logger.debug("Frame check failed, ignoring!!")
246-
self.resetFrame()
247-
else:
248-
txt = f"Frame - [{data}] not ready"
249-
_logger.debug(txt)
251+
txt = f"Frame - [{data}] not ready"
252+
_logger.debug(txt)
253+
break
250254

251255
def buildPacket(self, message):
252256
"""Create a ready to send modbus packet.

pymodbus/repl/server/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from pymodbus.framer.socket_framer import ModbusSocketFramer
1414
from pymodbus.repl.server.cli import run_repl
15-
from pymodbus.server.reactive.default_config import DEFUALT_CONFIG
15+
from pymodbus.server.reactive.default_config import DEFAULT_CONFIG
1616
from pymodbus.server.reactive.main import (
1717
DEFAULT_FRAMER,
1818
DEFUALT_HANDLERS,
@@ -161,7 +161,7 @@ def run(
161161
with open(modbus_config) as my_file: # pylint: disable=unspecified-encoding
162162
modbus_config = json.load(my_file)
163163
else:
164-
modbus_config = DEFUALT_CONFIG
164+
modbus_config = DEFAULT_CONFIG
165165

166166
modbus_config = modbus_config.get(modbus_server, {})
167167

pymodbus/server/reactive/default_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Configuration for Pymodbus REPL Reactive Module."""
22

3-
DEFUALT_CONFIG = { # pylint: disable=consider-using-namedtuple-or-dataclass
3+
DEFAULT_CONFIG = { # pylint: disable=consider-using-namedtuple-or-dataclass
44
"tcp": {
55
"handler": "ModbusConnectedRequestHandler",
66
"allow_reuse_address": True,

pymodbus/version.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ def __init__(self, package, major, minor, micro, pre=None):
2424

2525
def short(self):
2626
"""Return a string in canonical short version format: <major>.<minor>.<micro>.<pre>."""
27+
pre = ""
2728
if self.pre:
28-
return f"{self.major}.{self.minor}.{self.micro}.{self.pre}"
29-
return f"{self.major}.{self.minor}.{self.micro}"
29+
pre = f".{self.pre}"
30+
return f"{self.major}.{self.minor}.{self.micro}{pre}"
3031

3132
def __str__(self):
3233
"""Return a string representation of the object.
@@ -36,13 +37,16 @@ def __str__(self):
3637
return f"[{self.package}, version {self.short()}]"
3738

3839

39-
version = Version("pymodbus", 3, 0, 0, "dev5")
40+
version = Version("pymodbus", 3, 0, 0, "rc1")
4041
version.__name__ = ( # fix epydoc error # pylint: disable=attribute-defined-outside-init
4142
"pymodbus"
4243
)
4344

45+
4446
# --------------------------------------------------------------------------- #
4547
# Exported symbols
4648
# --------------------------------------------------------------------------- #
4749

48-
__all__ = ["version"]
50+
__all__ = [
51+
"version"
52+
]

setup.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ url = https://github.com/riptideio/pymodbus/
1313
classifiers =
1414
Development Status :: 4 - Beta
1515
Environment :: Console
16-
Framework :: Twisted
1716
Framework :: AsyncIO
1817
Intended Audience :: Developers
1918
License :: OSI Approved :: BSD License

test/conftest.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import functools
33
import platform
44

5-
from pkg_resources import parse_version
65
import pytest
76

87
from pymodbus.interfaces import IModbusSlaveContext
@@ -13,15 +12,6 @@ def pytest_configure():
1312
pytest.IS_DARWIN = platform.system().lower() == "darwin"
1413
pytest.IS_WINDOWS = platform.system().lower() == "windows"
1514

16-
if pytest.IS_DARWIN:
17-
# check for SIERRA
18-
if parse_version("10.12") < parse_version(platform.mac_ver()[0]):
19-
pytest.SERIAL_PORT = "/dev/ptyp0"
20-
else:
21-
pytest.SERIAL_PORT = "/dev/ttyp0"
22-
else:
23-
pytest.SERIAL_PORT = "/dev/ptmx"
24-
2515

2616
# -----------------------------------------------------------------------#
2717
# Generic fixtures
@@ -81,9 +71,8 @@ def __len__(self):
8171
"""Get length."""
8272
return self.size
8373

84-
def __iter__(self): # pylint: disable=non-iterator-returned
74+
def __iter__(self):
8575
"""Iterate."""
86-
return []
8776

8877

8978
class mockSocket: # pylint: disable=invalid-name
@@ -110,10 +99,6 @@ def mock_retrieve(self, size):
11099
self.data = None
111100
return retval
112101

113-
def fileno(self):
114-
"""File number."""
115-
return 0
116-
117102
def close(self):
118103
"""Close."""
119104
return True
@@ -131,11 +116,6 @@ def send(self, msg):
131116
self.mock_store(msg)
132117
return len(msg)
133118

134-
def write(self, msg):
135-
"""Write."""
136-
self.mock_store(msg)
137-
return len(msg)
138-
139119
def recvfrom(self, size):
140120
"""Receive from."""
141121
return [self.mock_retrieve(size)]
@@ -149,10 +129,6 @@ def setblocking(self, flag): # pylint: disable=unused-argument
149129
"""Set blocking."""
150130
return None
151131

152-
def in_waiting(self):
153-
"""Do in waiting."""
154-
return None
155-
156132

157133
def run_coroutine(coro):
158134
"""Run a coroutine as top-level task by iterating through all yielded steps."""
@@ -164,8 +140,6 @@ def run_coroutine(coro):
164140
except StopIteration as exc:
165141
# coro reached end pass on its return value:
166142
return exc.value
167-
except: # noqa: E722 pylint: disable=try-except-raise
168-
raise
169143

170144

171145
def _yielded_return(return_value, *args): # pylint: disable=unused-argument
@@ -174,7 +148,6 @@ def _yielded_return(return_value, *args): # pylint: disable=unused-argument
174148
async def _():
175149
"""Actual generator producing value."""
176150
# yield
177-
return return_value
178151

179152
# return new generator each time this function is called:
180153
return _()

test/test_all_messages.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python3
21
"""Test all messages."""
32
import unittest
43

0 commit comments

Comments
 (0)