From 0905d017c69ee9f3727dc3480591ddb073fc746b Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Mon, 8 Jul 2024 15:30:27 +0200 Subject: [PATCH] Address review: consistently use SAMPLE_EDS iso. EDS_PATH --- test/test_local.py | 14 +++++++------- test/test_network.py | 4 ++-- test/test_nmt.py | 10 +++++----- test/test_pdo.py | 6 +++--- test/util.py | 1 - 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/test/test_local.py b/test/test_local.py index 4d284130..9c5fc0c1 100644 --- a/test/test_local.py +++ b/test/test_local.py @@ -2,7 +2,7 @@ import unittest import canopen -from .util import EDS_PATH +from .util import SAMPLE_EDS class TestSDO(unittest.TestCase): @@ -14,15 +14,15 @@ class TestSDO(unittest.TestCase): def setUpClass(cls): cls.network1 = canopen.Network() cls.network1.connect("test", interface="virtual") - cls.remote_node = cls.network1.add_node(2, EDS_PATH) + cls.remote_node = cls.network1.add_node(2, SAMPLE_EDS) cls.network2 = canopen.Network() cls.network2.connect("test", interface="virtual") - cls.local_node = cls.network2.create_node(2, EDS_PATH) + cls.local_node = cls.network2.create_node(2, SAMPLE_EDS) - cls.remote_node2 = cls.network1.add_node(3, EDS_PATH) + cls.remote_node2 = cls.network1.add_node(3, SAMPLE_EDS) - cls.local_node2 = cls.network2.create_node(3, EDS_PATH) + cls.local_node2 = cls.network2.create_node(3, SAMPLE_EDS) @classmethod def tearDownClass(cls): @@ -177,11 +177,11 @@ class TestPDO(unittest.TestCase): def setUpClass(cls): cls.network1 = canopen.Network() cls.network1.connect("test", interface="virtual") - cls.remote_node = cls.network1.add_node(2, EDS_PATH) + cls.remote_node = cls.network1.add_node(2, SAMPLE_EDS) cls.network2 = canopen.Network() cls.network2.connect("test", interface="virtual") - cls.local_node = cls.network2.create_node(2, EDS_PATH) + cls.local_node = cls.network2.create_node(2, SAMPLE_EDS) @classmethod def tearDownClass(cls): diff --git a/test/test_network.py b/test/test_network.py index 41443285..ed440326 100644 --- a/test/test_network.py +++ b/test/test_network.py @@ -3,14 +3,14 @@ import canopen import can -from .util import EDS_PATH +from .util import SAMPLE_EDS class TestNetwork(unittest.TestCase): def setUp(self): network = canopen.Network() - network.add_node(2, EDS_PATH) + network.add_node(2, SAMPLE_EDS) network.add_node(3, network[2].object_dictionary) self.network = network diff --git a/test/test_nmt.py b/test/test_nmt.py index 97d196ca..50db1187 100644 --- a/test/test_nmt.py +++ b/test/test_nmt.py @@ -2,20 +2,20 @@ import unittest import canopen -from .util import EDS_PATH +from .util import SAMPLE_EDS class TestNmtSlave(unittest.TestCase): def setUp(self): self.network1 = canopen.Network() self.network1.connect("test", interface="virtual") - self.remote_node = self.network1.add_node(2, EDS_PATH) + self.remote_node = self.network1.add_node(2, SAMPLE_EDS) self.network2 = canopen.Network() self.network2.connect("test", interface="virtual") - self.local_node = self.network2.create_node(2, EDS_PATH) - self.remote_node2 = self.network1.add_node(3, EDS_PATH) - self.local_node2 = self.network2.create_node(3, EDS_PATH) + self.local_node = self.network2.create_node(2, SAMPLE_EDS) + self.remote_node2 = self.network1.add_node(3, SAMPLE_EDS) + self.local_node2 = self.network2.create_node(3, SAMPLE_EDS) def tearDown(self): self.network1.disconnect() diff --git a/test/test_pdo.py b/test/test_pdo.py index c2d6344a..7e9947f1 100644 --- a/test/test_pdo.py +++ b/test/test_pdo.py @@ -1,13 +1,13 @@ import unittest import canopen -from .util import EDS_PATH +from .util import SAMPLE_EDS class TestPDO(unittest.TestCase): def test_bit_mapping(self): - node = canopen.Node(1, EDS_PATH) + node = canopen.Node(1, SAMPLE_EDS) map = node.pdo.tx[1] map.add_variable('INTEGER16 value') # 0x2001 map.add_variable('UNSIGNED8 value', length=4) # 0x2002 @@ -55,7 +55,7 @@ def test_bit_mapping(self): self.assertEqual(node.pdo[0x1600][0x2002].raw, 0xf) def test_save_pdo(self): - node = canopen.Node(1, EDS_PATH) + node = canopen.Node(1, SAMPLE_EDS) node.tpdo.save() node.rpdo.save() diff --git a/test/util.py b/test/util.py index ca3620bc..a4395921 100644 --- a/test/util.py +++ b/test/util.py @@ -3,4 +3,3 @@ DATATYPES_EDS = os.path.join(os.path.dirname(__file__), "datatypes.eds") SAMPLE_EDS = os.path.join(os.path.dirname(__file__), "sample.eds") -EDS_PATH = SAMPLE_EDS