Import queue from six.moves

This commit is contained in:
Dana Powers
2016-01-03 19:50:21 -08:00
parent ed8f2212bf
commit 03d37dff5c
3 changed files with 6 additions and 18 deletions

View File

@@ -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,

View File

@@ -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,

View File

@@ -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