Skip to content

Commit

Permalink
Address review: consistently use SAMPLE_EDS iso. EDS_PATH
Browse files Browse the repository at this point in the history
  • Loading branch information
erlend-aasland committed Jul 8, 2024
1 parent 3c72ea7 commit 0905d01
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
14 changes: 7 additions & 7 deletions test/test_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import unittest

import canopen
from .util import EDS_PATH
from .util import SAMPLE_EDS


class TestSDO(unittest.TestCase):
Expand All @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions test/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions test/test_nmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions test/test_pdo.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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()

Expand Down
1 change: 0 additions & 1 deletion test/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 0905d01

Please sign in to comment.