From 6f8272718d458b8f51ce293f82c8d5d73125ab55 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 20 Jul 2023 15:51:17 -0700 Subject: [PATCH] Update connectivity python test Previous test depended on which track was first. Re-saving the board changed the track order, so there was no pad connected. It was still in the connectivity database, just not at the first track (cherry picked from commit 2485e9a38a741737254340c15da60d0b08edda4b) --- qa/testcases/test_005_connectivity_data.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/qa/testcases/test_005_connectivity_data.py b/qa/testcases/test_005_connectivity_data.py index 640a3aaff5..4b7e6981f3 100644 --- a/qa/testcases/test_005_connectivity_data.py +++ b/qa/testcases/test_005_connectivity_data.py @@ -12,7 +12,6 @@ class TestConnectivity(unittest.TestCase): """Setup shared attributes.""" self.pcb = pcbnew.LoadBoard("data/pcbnew/complex_hierarchy.kicad_pcb") self.connectivity = self.pcb.GetConnectivity() - self.nets = self.pcb.GetNetsByName() def test_get_connectivity_returns_connectivity_data_object(self): """Verify: GetConnectivity() returns a CONNECTIVITY_DATA object.""" @@ -21,20 +20,20 @@ class TestConnectivity(unittest.TestCase): def test_get_connected_pads_on_track_returns_iterable_of_pads(self): """Verify: GetConnectedPads(track) returns an iterable of pads.""" - net = list(self.nets.values())[1] - tracks = list(self.pcb.TracksInNet(net.GetNetCode())) + tracks = list(self.pcb.TracksInNet(self.pcb.GetNetcodeFromNetname("/12Vext"))) track_with_pad = tracks[1] + """Note that this returns just the elements directly connected, not everything in the net""" pads = self.connectivity.GetConnectedPads(track_with_pad) self.assertGreater(len(pads), 0) self.assertTrue(all(pad.GetClass() == "PAD" for pad in pads)) def test_get_connected_tracks_returns_iterable_of_tracks(self): """Verify: GetConnectedTracks(track) returns an iterable of tracks.""" - net = list(self.nets.values())[1] - net_tracks = self.pcb.TracksInNet(net.GetNetCode()) + net_tracks = self.pcb.TracksInNet(self.pcb.GetNetcodeFromNetname("/12Vext")) net_track = list(net_tracks)[0] + """Note that this returns just the elements directly connected, not everything in the net""" connected_tracks = self.connectivity.GetConnectedTracks(net_track) - self.assertGreater(len(connected_tracks), 1) + self.assertGreater(len(connected_tracks), 0) self.assertTrue( all(track.GetClass() == "PCB_TRACK" for track in connected_tracks) )