Import queue from six.moves
This commit is contained in:
@@ -3,12 +3,10 @@ from __future__ import absolute_import
|
||||
from collections import namedtuple
|
||||
import logging
|
||||
from multiprocessing import Process, Manager as MPManager
|
||||
try:
|
||||
import queue # python 3
|
||||
except ImportError:
|
||||
import Queue as queue # python 2
|
||||
import time
|
||||
|
||||
from six.moves import queue
|
||||
|
||||
from ..common import KafkaError
|
||||
from .base import (
|
||||
Consumer,
|
||||
|
||||
@@ -5,14 +5,11 @@ try:
|
||||
except ImportError:
|
||||
from itertools import izip_longest as izip_longest, repeat # pylint: disable=E0611
|
||||
import logging
|
||||
try:
|
||||
import queue # python 3
|
||||
except ImportError:
|
||||
import Queue as queue # python 2
|
||||
import sys
|
||||
import time
|
||||
|
||||
import six
|
||||
from six.moves import queue
|
||||
|
||||
from .base import (
|
||||
Consumer,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import collections
|
||||
import logging
|
||||
import threading
|
||||
import time
|
||||
|
||||
from mock import MagicMock, patch
|
||||
@@ -15,15 +16,7 @@ from kafka.common import (
|
||||
from kafka.producer.base import Producer, _send_upstream
|
||||
from kafka.protocol import CODEC_NONE
|
||||
|
||||
import threading
|
||||
try:
|
||||
from queue import Empty, Queue
|
||||
except ImportError:
|
||||
from Queue import Empty, Queue
|
||||
try:
|
||||
xrange
|
||||
except NameError:
|
||||
xrange = range
|
||||
from six.moves import queue, xrange
|
||||
|
||||
|
||||
class TestKafkaProducer(unittest.TestCase):
|
||||
@@ -130,7 +123,7 @@ class TestKafkaProducerSendUpstream(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.client = MagicMock()
|
||||
self.queue = Queue()
|
||||
self.queue = queue.Queue()
|
||||
|
||||
def _run_process(self, retries_limit=3, sleep_timeout=1):
|
||||
# run _send_upstream process with the queue
|
||||
|
||||
Reference in New Issue
Block a user