From bd9052455092630e03485538a29f9f8d147c41ca Mon Sep 17 00:00:00 2001 From: Rosemarie O'Riorden Date: Tue, 15 Jun 2021 11:58:02 -0400 Subject: Remove Python 2 leftovers. Fixes: 1ca0323e7c29 ("Require Python 3 and remove support for Python 2.") Reported at: https://bugzilla.redhat.com/show_bug.cgi?id=1949875 Signed-off-by: Rosemarie O'Riorden Signed-off-by: Ilya Maximets --- python/ovstest/rpcserver.py | 14 +++----------- python/ovstest/tcp.py | 4 ++-- python/ovstest/tests.py | 2 -- python/ovstest/util.py | 4 +--- python/ovstest/vswitch.py | 2 +- 5 files changed, 7 insertions(+), 19 deletions(-) (limited to 'python/ovstest') diff --git a/python/ovstest/rpcserver.py b/python/ovstest/rpcserver.py index c4aab7020..05b6b1be2 100644 --- a/python/ovstest/rpcserver.py +++ b/python/ovstest/rpcserver.py @@ -18,22 +18,14 @@ rpcserver is an XML RPC server that allows RPC client to initiate tests import sys -import exceptions - import xmlrpc.client -import tcp - from twisted.internet import reactor from twisted.internet.error import CannotListenError from twisted.web import server from twisted.web import xmlrpc -import udp - -import util - -import vswitch +from . import tcp, udp, util, vswitch class TestArena(xmlrpc.XMLRPC): @@ -210,7 +202,7 @@ class TestArena(xmlrpc.XMLRPC): (_, port) = self.__get_handle_resources(handle) port.loseConnection() self.__delete_handle(handle) - except exceptions.KeyError: + except KeyError: return -1 return 0 @@ -222,7 +214,7 @@ class TestArena(xmlrpc.XMLRPC): (_, connector) = self.__get_handle_resources(handle) connector.disconnect() self.__delete_handle(handle) - except exceptions.KeyError: + except KeyError: return -1 return 0 diff --git a/python/ovstest/tcp.py b/python/ovstest/tcp.py index c495717f2..098c6cba3 100644 --- a/python/ovstest/tcp.py +++ b/python/ovstest/tcp.py @@ -21,7 +21,7 @@ import time from twisted.internet import interfaces from twisted.internet.protocol import ClientFactory, Factory, Protocol -from zope.interface import implements +from zope.interface.declarations import implementer class TcpListenerConnection(Protocol): @@ -55,8 +55,8 @@ class TcpListenerFactory(Factory): return str(self.stats) +@implementer(interfaces.IPushProducer) class Producer(object): - implements(interfaces.IPushProducer) """ This producer class generates infinite byte stream for a specified time duration diff --git a/python/ovstest/tests.py b/python/ovstest/tests.py index 6de3cc3af..f959f945e 100644 --- a/python/ovstest/tests.py +++ b/python/ovstest/tests.py @@ -10,8 +10,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from __future__ import print_function - import math import time diff --git a/python/ovstest/util.py b/python/ovstest/util.py index 72457158f..270d6a037 100644 --- a/python/ovstest/util.py +++ b/python/ovstest/util.py @@ -26,8 +26,6 @@ import socket import struct import subprocess -import exceptions - import xmlrpc.client @@ -88,7 +86,7 @@ def start_process(args): stderr=subprocess.PIPE) out, err = p.communicate() return (p.returncode, out, err) - except exceptions.OSError: + except OSError: return (-1, None, None) diff --git a/python/ovstest/vswitch.py b/python/ovstest/vswitch.py index 9d5b5cffd..45c9587ee 100644 --- a/python/ovstest/vswitch.py +++ b/python/ovstest/vswitch.py @@ -15,7 +15,7 @@ """ vswitch module allows its callers to interact with OVS DB. """ -import util +from . import util def ovs_vsctl_add_bridge(bridge): -- cgit v1.2.1