diff --git a/tests/integration/long/test_large_data.py b/tests/integration/long/test_large_data.py index a79a6da4f5..0a1b368bf0 100644 --- a/tests/integration/long/test_large_data.py +++ b/tests/integration/long/test_large_data.py @@ -12,10 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -try: - from Queue import Queue, Empty -except ImportError: - from queue import Queue, Empty # noqa +from queue import Queue, Empty from struct import pack import logging, sys, traceback, time diff --git a/tests/integration/standard/test_shard_aware.py b/tests/integration/standard/test_shard_aware.py index 215c69c3b4..48d1aa3609 100644 --- a/tests/integration/standard/test_shard_aware.py +++ b/tests/integration/standard/test_shard_aware.py @@ -17,15 +17,9 @@ from subprocess import run import logging -try: - from concurrent.futures import ThreadPoolExecutor, as_completed -except ImportError: - from futures import ThreadPoolExecutor, as_completed # noqa - -try: - import unittest2 as unittest -except ImportError: - import unittest # noqa +from concurrent.futures import ThreadPoolExecutor, as_completed + +import unittest import pytest from cassandra.cluster import Cluster diff --git a/tests/integration/standard/test_use_keyspace.py b/tests/integration/standard/test_use_keyspace.py index 72ddbf9ef4..25e954b956 100644 --- a/tests/integration/standard/test_use_keyspace.py +++ b/tests/integration/standard/test_use_keyspace.py @@ -2,10 +2,7 @@ import time import logging -try: - import unittest2 as unittest -except ImportError: - import unittest # noqa +import unittest from unittest.mock import patch diff --git a/tests/unit/io/eventlet_utils.py b/tests/unit/io/eventlet_utils.py index 785856be20..2a5a8c78d0 100644 --- a/tests/unit/io/eventlet_utils.py +++ b/tests/unit/io/eventlet_utils.py @@ -16,21 +16,15 @@ import os import select import socket -try: - import thread - import Queue - import __builtin__ - #For python3 compatibility -except ImportError: - import _thread as thread - import queue as Queue - import builtins as __builtin__ +import _thread as thread +import queue as Queue +import builtins as __builtin__ import threading import ssl import time import eventlet -from imp import reload +from importlib import reload def eventlet_un_patch_all(): """ diff --git a/tests/unit/test_protocol_features.py b/tests/unit/test_protocol_features.py index 89b568ea68..895c384f7e 100644 --- a/tests/unit/test_protocol_features.py +++ b/tests/unit/test_protocol_features.py @@ -1,7 +1,4 @@ -try: - import unittest2 as unittest -except ImportError: - import unittest # noqa +import unittest import logging diff --git a/tests/unit/test_shard_aware.py b/tests/unit/test_shard_aware.py index 0d13a243ab..e7d26ae207 100644 --- a/tests/unit/test_shard_aware.py +++ b/tests/unit/test_shard_aware.py @@ -12,10 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -try: - import unittest2 as unittest -except ImportError: - import unittest # noqa +import unittest import logging from unittest.mock import MagicMock