[Python-checkins] bpo-40297: Fix test_socket.CANTest.testSendFrame (GH-19548)

miss-islington webhook-mailer at python.org
Tue May 4 17:03:56 EDT 2021


https://github.com/python/cpython/commit/df99532a05e4cfba8d9835375d4a3830b84472ad
commit: df99532a05e4cfba8d9835375d4a3830b84472ad
branch: 3.9
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2021-05-04T14:03:48-07:00
summary:

bpo-40297: Fix test_socket.CANTest.testSendFrame (GH-19548)


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 at users.noreply.github.com>

files:
M Lib/test/test_socket.py

diff --git a/Lib/test/test_socket.py b/Lib/test/test_socket.py
index aefba4f397b10..595cae6b640f7 100755
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -222,7 +222,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
@@ -2048,7 +2048,6 @@ def testSendFrame(self):
         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')



More information about the Python-checkins mailing list