Skip to content

Commit c3d4685

Browse files
authored
Merge pull request #163 from riptideio/dev
preparing for pymodbus 1.3.0
2 parents 9517a05 + e781196 commit c3d4685

File tree

7 files changed

+44
-27
lines changed

7 files changed

+44
-27
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ build/
44
dist/
55
pymodbus.egg-info/
66
.coverage
7+
.vscode
8+
.idea
9+
.noseids

pymodbus/version.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,26 @@
99

1010
class Version(object):
1111

12-
def __init__(self, package, major, minor, micro):
12+
def __init__(self, package, major, minor, micro, pre):
1313
'''
1414
1515
:param package: Name of the package that this is a version of.
1616
:param major: The major version number.
1717
:param minor: The minor version number.
1818
:param micro: The micro version number.
19+
:param pre: The pre release tag
1920
'''
2021
self.package = package
2122
self.major = major
2223
self.minor = minor
2324
self.micro = micro
25+
self.pre = pre
2426

2527
def short(self):
2628
''' Return a string in canonical short version format
27-
<major>.<minor>.<micro>
29+
<major>.<minor>.<micro>.<pre>
2830
'''
29-
return '%d.%d.%d' % (self.major, self.minor, self.micro)
31+
return '%d.%d.%d.%s' % (self.major, self.minor, self.micro, self.pre)
3032

3133
def __str__(self):
3234
''' Returns a string representation of the object
@@ -35,7 +37,7 @@ def __str__(self):
3537
'''
3638
return '[%s, version %s]' % (self.package, self.short())
3739

38-
version = Version('pymodbus', 1, 3, 0)
40+
version = Version('pymodbus', 1, 3, 0, "rc1")
3941
version.__name__ = 'pymodbus' # fix epydoc error
4042

4143
#---------------------------------------------------------------------------#

requirements.txt

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
# -------------------------------------------------------------------
22
# if want to use the pymodbus serial stack, uncomment these
33
# -------------------------------------------------------------------
4-
#pyserial==2.6
4+
#pyserial==3.3
55
# -------------------------------------------------------------------
66
# if you want to run the tests and code coverage, uncomment these
77
# -------------------------------------------------------------------
8-
#coverage==3.5.3
9-
#mock==1.0b1
10-
#nose==1.2.1
11-
#pep8==1.3.3
8+
#coverage==4.4
9+
#mock==2.0.0
10+
#nose==1.3.7
11+
#pep8==1.7.0
1212
# -------------------------------------------------------------------
1313
# if you want to use the asynchronous version, uncomment these
1414
# -------------------------------------------------------------------
15-
#Twisted==12.2.0
16-
#zope.interface==4.0.1
17-
#pyasn1==0.1.4
18-
#pycrypto==2.6
15+
#Twisted==17.1.0
16+
#zope.interface==4.4.0
17+
#pyasn1==0.2.3
18+
#pycrypto==2.6.1
1919
#wsgiref==0.1.2
20+
#cryptography==1.8.1
2021
# -------------------------------------------------------------------
2122
# if you want to build the documentation, uncomment these
2223
# -------------------------------------------------------------------
23-
#Jinja2==2.6
24-
#Pygments==1.5
25-
#Sphinx==1.1.3
26-
#docutils==0.9.1
24+
#Jinja2==2.9.6
25+
#Pygments==2.2.0
26+
#Sphinx==1.5.5
27+
#docutils==0.13.1
28+
#pydoctor==16.3.0
29+

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353
author = __author__,
5454
author_email = '[email protected]',
5555
maintainer = __author__,
56-
maintainer_email = 'bashwork@gmail.com',
57-
url='http://code.google.com/p/pymodbus/',
56+
maintainer_email = 'otlasanju@gmail.com',
57+
url='https://github.com/riptideio/pymodbus/',
5858
license = 'BSD',
5959
packages = find_packages(exclude=['examples', 'test']),
6060
exclude_package_data = {'' : ['examples', 'test', 'tools', 'doc']},

test/test_server_async.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55
from pymodbus.server.async import ModbusTcpProtocol, ModbusUdpProtocol
66
from pymodbus.server.async import ModbusServerFactory
77
from pymodbus.server.async import StartTcpServer, StartUdpServer, StartSerialServer
8-
from pymodbus.exceptions import ConnectionException, NotImplementedException
9-
from pymodbus.exceptions import ParameterException
10-
from pymodbus.bit_read_message import ReadCoilsRequest, ReadCoilsResponse
118

9+
10+
import sys
1211
#---------------------------------------------------------------------------#
1312
# Fixture
1413
#---------------------------------------------------------------------------#
14+
SERIAL_PORT = "/dev/ptmx"
15+
if sys.platform == "darwin":
16+
SERIAL_PORT = "/dev/ptyp0"
17+
18+
1519
class AsynchronousServerTest(unittest.TestCase):
1620
'''
1721
This is the unittest for the pymodbus.server.async module
@@ -84,7 +88,7 @@ def testUdpServerStartup(self):
8488
def testSerialServerStartup(self):
8589
''' Test that the modbus serial async server starts correctly '''
8690
with patch('twisted.internet.reactor') as mock_reactor:
87-
StartSerialServer(context=None, port='/dev/ptmx')
91+
StartSerialServer(context=None, port=SERIAL_PORT)
8892
self.assertEqual(mock_reactor.run.call_count, 1)
8993

9094
#---------------------------------------------------------------------------#

test/test_server_sync.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
from pymodbus.server.sync import StartTcpServer, StartUdpServer, StartSerialServer
1515
from pymodbus.exceptions import NotImplementedException
1616
from pymodbus.bit_read_message import ReadCoilsRequest, ReadCoilsResponse
17+
import sys
1718

19+
SERIAL_PORT = "/dev/ptmx"
20+
if sys.platform == "darwin":
21+
SERIAL_PORT = "/dev/ptyp0"
1822
#---------------------------------------------------------------------------#
1923
# Mock Classes
2024
#---------------------------------------------------------------------------#
@@ -322,7 +326,7 @@ def testStartUdpServer(self):
322326
def testStartSerialServer(self):
323327
''' Test the serial server starting factory '''
324328
with patch.object(ModbusSerialServer, 'serve_forever') as mock_server:
325-
StartSerialServer()
329+
StartSerialServer(port=SERIAL_PORT)
326330

327331
#---------------------------------------------------------------------------#
328332
# Main

test/test_version.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ def tearDown(self):
1616
pass
1717

1818
def testVersionClass(self):
19-
version = Version('test', 1,2,3)
20-
self.assertEqual(version.short(), '1.2.3')
21-
self.assertEqual(str(version), '[test, version 1.2.3]')
19+
version = Version('test', 1,2,3, "sometag")
20+
short = version.short()
21+
self.assertEqual(version.short(), '1.2.3.sometag')
22+
self.assertEqual(str(version), '[test, version 1.2.3.sometag]')
2223

2324
#---------------------------------------------------------------------------#
2425
# Main

0 commit comments

Comments
 (0)