diff options
author | Paul Vinciguerra <pvinci@vinciconsulting.com> | 2020-12-03 00:42:46 -0500 |
---|---|---|
committer | Ole Tr�an <otroan@employees.org> | 2020-12-03 19:43:23 +0000 |
commit | 090096bff365b4ad69c061303c0852bf214b4f03 (patch) | |
tree | 04ce3aa4df1f81d37acdf398dc0ef4ee3f245cd4 | |
parent | 4a856f9593fb36fe7fdd2d6bcf79d9a7fada36ef (diff) |
tests: remove py2/py3 six compatability library
Type: test
Change-Id: Idb6b8169845e0239e639429ccfd02a683212b7e6
Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
-rw-r--r-- | src/plugins/lisp/test/test_lisp.py | 4 | ||||
-rw-r--r-- | src/plugins/memif/test/test_memif.py | 1 | ||||
-rw-r--r-- | src/plugins/memif/test/vpp_memif.py | 2 | ||||
-rw-r--r-- | test/remote_test.py | 9 | ||||
-rw-r--r-- | test/template_bd.py | 6 | ||||
-rw-r--r-- | test/test_bfd.py | 4 | ||||
-rw-r--r-- | test/test_reassembly.py | 15 | ||||
-rw-r--r-- | test/util.py | 1 | ||||
-rw-r--r-- | test/vpp_interface.py | 6 | ||||
-rw-r--r-- | test/vpp_object.py | 6 | ||||
-rw-r--r-- | test/vpp_sub_interface.py | 4 | ||||
-rw-r--r-- | test/vpp_tunnel_interface.py | 4 |
12 files changed, 19 insertions, 43 deletions
diff --git a/src/plugins/lisp/test/test_lisp.py b/src/plugins/lisp/test/test_lisp.py index 70cb4f4bf34..0bb42112140 100644 --- a/src/plugins/lisp/test/test_lisp.py +++ b/src/plugins/lisp/test/test_lisp.py @@ -1,7 +1,6 @@ #!/usr/bin/env python3 import abc -import six import unittest from scapy.fields import BitField, ByteField, FlagsField, IntField @@ -32,8 +31,7 @@ bind_layers(LISP_GPE_Header, IPv6, next_proto=2) bind_layers(LISP_GPE_Header, Ether, next_proto=3) -@six.add_metaclass(abc.ABCMeta) -class Driver(object): +class Driver(metaclass=abc.ABCMeta): config_order = ['locator-sets', 'locators', diff --git a/src/plugins/memif/test/test_memif.py b/src/plugins/memif/test/test_memif.py index 244818cfc3a..f2bbded320b 100644 --- a/src/plugins/memif/test/test_memif.py +++ b/src/plugins/memif/test/test_memif.py @@ -3,7 +3,6 @@ import unittest from scapy.layers.l2 import Ether from scapy.layers.inet import IP, ICMP -import six from framework import VppTestCase, VppTestRunner, running_extended_tests from remote_test import RemoteClass, RemoteVppTestCase diff --git a/src/plugins/memif/test/vpp_memif.py b/src/plugins/memif/test/vpp_memif.py index 9afed6fb63c..226f8af72b5 100644 --- a/src/plugins/memif/test/vpp_memif.py +++ b/src/plugins/memif/test/vpp_memif.py @@ -1,8 +1,6 @@ import socket from ipaddress import IPv4Network -import six - from vpp_object import VppObject from vpp_papi import VppEnum diff --git a/test/remote_test.py b/test/remote_test.py index ea271d58a89..c9686f57f06 100644 --- a/test/remote_test.py +++ b/test/remote_test.py @@ -2,12 +2,11 @@ import inspect import os +import reprlib import unittest from framework import VppTestCase from multiprocessing import Process, Pipe from pickle import dumps -import six -from six import moves import sys from enum import IntEnum, IntFlag @@ -110,7 +109,7 @@ class RemoteClass(Process): self._pipe = Pipe() # pipe for input/output arguments def __repr__(self): - return moves.reprlib.repr(RemoteClassAttr(self, None)) + return reprlib.repr(RemoteClassAttr(self, None)) def __str__(self): return str(RemoteClassAttr(self, None)) @@ -144,7 +143,7 @@ class RemoteClass(Process): isinstance(val, RemoteClassAttr): mutable_args[i] = val.get_remote_value() args = tuple(mutable_args) - for key, val in six.iteritems(kwargs): + for key, val in kwargs.items(): if isinstance(val, RemoteClass) or \ isinstance(val, RemoteClassAttr): kwargs[key] = val.get_remote_value() @@ -201,7 +200,7 @@ class RemoteClass(Process): def _get_local_repr(self, path): try: obj = self._get_local_object(path) - return moves.reprlib.repr(obj) + return reprlib.repr(obj) except AttributeError: return None diff --git a/test/template_bd.py b/test/template_bd.py index 198cc2258b8..bebe76d765d 100644 --- a/test/template_bd.py +++ b/test/template_bd.py @@ -1,17 +1,13 @@ #!/usr/bin/env python3 import abc -import six from scapy.layers.l2 import Ether from scapy.packet import Raw from scapy.layers.inet import IP, UDP -from util import ip4_range - -@six.add_metaclass(abc.ABCMeta) -class BridgeDomain(object): +class BridgeDomain(metaclass=abc.ABCMeta): """ Bridge domain abstraction """ @property diff --git a/test/test_bfd.py b/test/test_bfd.py index f66f75a3408..784cdadb24d 100644 --- a/test/test_bfd.py +++ b/test/test_bfd.py @@ -6,13 +6,13 @@ from __future__ import division import binascii import hashlib import ipaddress +import reprlib import time import unittest from random import randint, shuffle, getrandbits from socket import AF_INET, AF_INET6, inet_ntop from struct import pack, unpack -from six import moves import scapy.compat from scapy.layers.inet import UDP, IP from scapy.layers.inet6 import IPv6 @@ -624,7 +624,7 @@ def verify_udp(test, packet): def verify_event(test, event, expected_state): """ Verify correctness of event values. """ e = event - test.logger.debug("BFD: Event: %s" % moves.reprlib.repr(e)) + test.logger.debug("BFD: Event: %s" % reprlib.repr(e)) test.assert_equal(e.sw_if_index, test.vpp_session.interface.sw_if_index, "BFD interface index") diff --git a/test/test_reassembly.py b/test/test_reassembly.py index cb6b8ff5d3f..797fb527415 100644 --- a/test/test_reassembly.py +++ b/test/test_reassembly.py @@ -1,6 +1,5 @@ #!/usr/bin/env python3 -import six import unittest from random import shuffle, choice, randrange @@ -95,7 +94,7 @@ class TestIPv4Reassembly(VppTestCase): def create_fragments(cls): infos = cls._packet_infos cls.pkt_infos = [] - for index, info in six.iteritems(infos): + for index, info in infos.items(): p = info.data # cls.logger.debug(ppp("Packet:", # p.__class__(scapy.compat.raw(p)))) @@ -811,7 +810,7 @@ class TestIPv4MWReassembly(VppTestCase): def create_fragments(cls): infos = cls._packet_infos cls.pkt_infos = [] - for index, info in six.iteritems(infos): + for index, info in infos.items(): p = info.data # cls.logger.debug(ppp("Packet:", # p.__class__(scapy.compat.raw(p)))) @@ -986,7 +985,7 @@ class TestIPv6Reassembly(VppTestCase): def create_fragments(cls): infos = cls._packet_infos cls.pkt_infos = [] - for index, info in six.iteritems(infos): + for index, info in infos.items(): p = info.data # cls.logger.debug(ppp("Packet:", # p.__class__(scapy.compat.raw(p)))) @@ -1444,7 +1443,7 @@ class TestIPv6MWReassembly(VppTestCase): def create_fragments(cls): infos = cls._packet_infos cls.pkt_infos = [] - for index, info in six.iteritems(infos): + for index, info in infos.items(): p = info.data # cls.logger.debug(ppp("Packet:", # p.__class__(scapy.compat.raw(p)))) @@ -1782,7 +1781,7 @@ class TestIPv4ReassemblyLocalNode(VppTestCase): def create_fragments(cls): infos = cls._packet_infos cls.pkt_infos = [] - for index, info in six.iteritems(infos): + for index, info in infos.items(): p = info.data # cls.logger.debug(ppp("Packet:", # p.__class__(scapy.compat.raw(p)))) @@ -1973,7 +1972,7 @@ class TestFIFReassembly(VppTestCase): self.extend_packet(p, size, self.padding) info.data = p[IP] # use only IP part, without ethernet header - fragments = [x for _, p in six.iteritems(self._packet_infos) + fragments = [x for _, p in self._packet_infos.items() for x in fragment_rfc791(p.data, 400)] encapped_fragments = \ @@ -2038,7 +2037,7 @@ class TestFIFReassembly(VppTestCase): self.extend_packet(p, size, self.padding) info.data = p[IPv6] # use only IPv6 part, without ethernet header - fragments = [x for _, i in six.iteritems(self._packet_infos) + fragments = [x for _, i in self._packet_infos.items() for x in fragment_rfc8200( i.data, i.index, 400)] diff --git a/test/util.py b/test/util.py index c7e4693e998..fc1eae03742 100644 --- a/test/util.py +++ b/test/util.py @@ -5,7 +5,6 @@ import ipaddress import logging import socket from socket import AF_INET6 -import six import sys import os.path diff --git a/test/vpp_interface.py b/test/vpp_interface.py index cb1fbafce48..32d8166fc43 100644 --- a/test/vpp_interface.py +++ b/test/vpp_interface.py @@ -2,9 +2,6 @@ import binascii import socket import abc -import six -from six import moves - from util import Host, mk_ll_addr from vpp_papi import mac_ntop, VppEnum from ipaddress import IPv4Network, IPv6Network @@ -15,8 +12,7 @@ except NameError: text_type = str -@six.add_metaclass(abc.ABCMeta) -class VppInterface(object): +class VppInterface(metaclass=abc.ABCMeta): """Generic VPP interface.""" @property diff --git a/test/vpp_object.py b/test/vpp_object.py index df44efbbda7..2a993ff9e7c 100644 --- a/test/vpp_object.py +++ b/test/vpp_object.py @@ -1,13 +1,9 @@ """ abstract vpp object and object registry """ import abc -import six -from six import moves - -@six.add_metaclass(abc.ABCMeta) -class VppObject(object): +class VppObject(metaclass=abc.ABCMeta): """ Abstract vpp object """ @abc.abstractmethod diff --git a/test/vpp_sub_interface.py b/test/vpp_sub_interface.py index 8f422d8a050..989769f09fb 100644 --- a/test/vpp_sub_interface.py +++ b/test/vpp_sub_interface.py @@ -1,6 +1,5 @@ from scapy.layers.l2 import Dot1Q import abc -import six from vpp_pg_interface import VppPGInterface from vpp_interface import VppInterface from vpp_papi import VppEnum @@ -18,8 +17,7 @@ class L2_VTR_OP: L2_TRANSLATE_2_2 = 8 -@six.add_metaclass(abc.ABCMeta) -class VppSubInterface(VppPGInterface): +class VppSubInterface(VppPGInterface, metaclass=abc.ABCMeta): @property def parent(self): diff --git a/test/vpp_tunnel_interface.py b/test/vpp_tunnel_interface.py index e55486e1675..6a336eb72d9 100644 --- a/test/vpp_tunnel_interface.py +++ b/test/vpp_tunnel_interface.py @@ -1,11 +1,9 @@ import abc -import six from vpp_pg_interface import is_ipv6_misc from vpp_interface import VppInterface -@six.add_metaclass(abc.ABCMeta) -class VppTunnelInterface(VppInterface): +class VppTunnelInterface(VppInterface, metaclass=abc.ABCMeta): """ VPP tunnel interface abstraction """ def __init__(self, test, parent_if): |