]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40297: Fix test_socket.CANTest.testSendFrame (GH-19548) (#25957)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Fri, 7 May 2021 13:54:42 +0000 (06:54 -0700)
committerGitHub <noreply@github.com>
Fri, 7 May 2021 13:54:42 +0000 (15:54 +0200)
The address tuple for CAN_RAW no longer returns the address family
after the introduction of CAN ISO-TP support in a30f6d45ac3. However,
updating test_socket.CANTest.testSendFrame was missed as part of the
change, so the test incorrectly attempts to index past the last tuple
item to retrieve the address family.

This removes the now-redundant check for equality against socket.AF_CAN,
as the tuple will not contain the address family.
(cherry picked from commit 355bae88822bee4de6092b63d69c5a5dad393a16)

Co-authored-by: karl ding <karlding@users.noreply.github.com>
Lib/test/test_socket.py

index f9370d8e52dca17faa1b275f6e24e855c3ff581d..eada6e929fe1594bbffdb207b182223b01d0ec18 100644 (file)
@@ -187,7 +187,7 @@ class SocketCANTest(unittest.TestCase):
     the following commands:
     # modprobe vcan
     # ip link add dev vcan0 type vcan
-    # ifconfig vcan0 up
+    # ip link set up vcan0
     """
     interface = 'vcan0'
     bufsize = 128
@@ -1954,7 +1954,6 @@ class CANTest(ThreadedCANSocketTest):
         cf, addr = self.s.recvfrom(self.bufsize)
         self.assertEqual(self.cf, cf)
         self.assertEqual(addr[0], self.interface)
-        self.assertEqual(addr[1], socket.AF_CAN)
 
     def _testSendFrame(self):
         self.cf = self.build_can_frame(0x00, b'\x01\x02\x03\x04\x05')