diff options
author | Lorenzo Colitti <lorenzo@google.com> | 2014-12-15 17:23:42 +0900 |
---|---|---|
committer | Lorenzo Colitti <lorenzo@google.com> | 2015-02-02 17:47:30 +0900 |
commit | b87c813197ab205074e3bdbad4a5e7e2eb39e9d2 (patch) | |
tree | 950b11dad0e4bc1cdbdf7bcc1cbc32d224847aee /tests | |
parent | de7c4f07a185470587e7940cb0324823b68ccf28 (diff) | |
download | extras-b87c813197ab205074e3bdbad4a5e7e2eb39e9d2.tar.gz |
Fix lint warnings.
Change-Id: Icd3053963fd2e69cddb35ac7cb24bc428d536d43
Diffstat (limited to 'tests')
-rw-r--r-- | tests/net_test/iproute.py | 3 | ||||
-rwxr-xr-x | tests/net_test/mark_test.py | 20 | ||||
-rwxr-xr-x | tests/net_test/ping6_test.py | 2 | ||||
-rwxr-xr-x | tests/net_test/srcaddr_selection_test.py | 8 |
4 files changed, 16 insertions, 17 deletions
diff --git a/tests/net_test/iproute.py b/tests/net_test/iproute.py index 804d1e09..a894ce3e 100644 --- a/tests/net_test/iproute.py +++ b/tests/net_test/iproute.py @@ -506,8 +506,7 @@ class IPRoute(object): RTM_DELADDR, address, prefixlen, 0, 0, ifindex) def GetAddress(self, address, ifindex=0): - """Returns an (ifaddrmsg, attributes) tuple for the requested address. - """ + """Returns an ifaddrmsg for the requested address.""" if ":" not in address: # The address is likely an IPv4 address. RTM_GETADDR without the # NLM_F_DUMP flag is not supported by the kernel. We do not currently diff --git a/tests/net_test/mark_test.py b/tests/net_test/mark_test.py index d3b8d9f1..03f3b818 100755 --- a/tests/net_test/mark_test.py +++ b/tests/net_test/mark_test.py @@ -431,7 +431,6 @@ class MultiNetworkTest(net_test.NetworkTest): @classmethod def SendRA(cls, netid, retranstimer=None): validity = 300 # seconds - validity_ms = validity * 1000 # milliseconds macaddr = cls.RouterMacAddress(netid) lladdr = cls._RouterAddress(netid, 6) @@ -1464,6 +1463,13 @@ class PMTUTest(InboundMarkingTest): s.setsockopt(net_test.SOL_IPV6, net_test.IPV6_RECVERR, 1) def CheckPMTU(self, version, use_connect, modes): + + def SendBigPacket(version, s, dstaddr, netid, payload): + if use_connect: + s.send(payload) + else: + self.SendOnNetid(version, s, dstaddr, 1234, netid, payload, []) + for netid in self.tuns: for mode in modes: s = self.BuildSocket(version, net_test.UDPSocket, netid, mode) @@ -1481,14 +1487,8 @@ class PMTUTest(InboundMarkingTest): payload = self.PAYLOAD_SIZE * "a" - def SendBigPacket(): - if use_connect: - s.send(payload) - else: - self.SendOnNetid(version, s, dstaddr, 1234, netid, payload, []) - # Send a packet and receive a packet too big. - SendBigPacket() + SendBigPacket(version, s, dstaddr, netid, payload) packets = self.ReadAllPacketsOn(netid) self.assertEquals(1, len(packets)) _, toobig = Packets.ICMPPacketTooBig(version, intermediate, srcaddr, @@ -1496,7 +1496,9 @@ class PMTUTest(InboundMarkingTest): self.ReceivePacketOn(netid, toobig) # Check that another send on the same socket returns EMSGSIZE. - self.assertRaisesErrno(errno.EMSGSIZE, SendBigPacket) + self.assertRaisesErrno( + errno.EMSGSIZE, + SendBigPacket, version, s, dstaddr, netid, payload) # If this is a connected socket, make sure the socket MTU was set. # Note that in IPv4 this only started working in Linux 3.6! diff --git a/tests/net_test/ping6_test.py b/tests/net_test/ping6_test.py index 7d0ba647..c5da4440 100755 --- a/tests/net_test/ping6_test.py +++ b/tests/net_test/ping6_test.py @@ -52,7 +52,7 @@ class Ping6Test(net_test.NetworkTest): self.assertGreaterEqual(len(addr), len("1.1.1.1")) self.assertTrue(rcvd.startswith("\x00\x00"), "Not an IPv4 echo reply") else: - addr, unused_port, flowlabel, scope_id = src + addr, unused_port, flowlabel, scope_id = src # pylint: disable=unbalanced-tuple-unpacking self.assertGreaterEqual(len(addr), len("::")) self.assertTrue(rcvd.startswith("\x81\x00"), "Not an IPv6 echo reply") # Check that the flow label is zero and that the scope ID is sane. diff --git a/tests/net_test/srcaddr_selection_test.py b/tests/net_test/srcaddr_selection_test.py index 4ba930d9..4c266d15 100755 --- a/tests/net_test/srcaddr_selection_test.py +++ b/tests/net_test/srcaddr_selection_test.py @@ -46,17 +46,15 @@ class IPv6SourceAddressSelectionTest(mark_test.MultiNetworkTest): def assertAddressHasExpectedAttributes( self, address, expected_ifindex, expected_flags): - (ifa_msg, attributes) = self.iproute.GetAddress(address) - self.assertEquals(AF_INET6 if ":" in address else AF_INET, - ifa_msg.family) + ifa_msg = self.iproute.GetAddress(address)[0] + self.assertEquals(AF_INET6 if ":" in address else AF_INET, ifa_msg.family) self.assertEquals(64, ifa_msg.prefixlen) self.assertEquals(iproute.RT_SCOPE_UNIVERSE, ifa_msg.scope) self.assertEquals(expected_ifindex, ifa_msg.index) - self.assertEquals(address, attributes["IFA_ADDRESS"]) self.assertEquals(expected_flags, ifa_msg.flags & expected_flags) def AddressIsTentative(self, address): - ifa_msg, _ = self.iproute.GetAddress(address) + ifa_msg = self.iproute.GetAddress(address)[0] return ifa_msg.flags & iproute.IFA_F_TENTATIVE def BindToAddress(self, address): |