1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
#!/usr/bin/env python
import unittest
from pymodbus.datastore.context import ModbusSlaveContext
from pymodbus.datastore.store import ModbusSequentialDataBlock
from base_context import ContextRunner
class MemorySlaveContextTest(ContextRunner, unittest.TestCase):
"""
These are the integration tests for using the in memory
slave context.
"""
def setUp(self):
""" Initializes the test environment """
self.context = ModbusSlaveContext(**{
'di' : ModbusSequentialDataBlock(0, [0]*100),
'co' : ModbusSequentialDataBlock(0, [0]*100),
'ir' : ModbusSequentialDataBlock(0, [0]*100),
'hr' : ModbusSequentialDataBlock(0, [0]*100)})
self.initialize()
def tearDown(self):
""" Cleans up the test environment """
self.shutdown()
# --------------------------------------------------------------------------- #
# Main
# --------------------------------------------------------------------------- #
if __name__ == "__main__":
unittest.main()
|