Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hubstorage/batchuploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import requests
from requests.compat import StringIO
from collections import deque
from Queue import Queue
from six.moves.queue import Queue
from threading import Thread, Event
from .utils import xauth, iterqueue
from .serialization import jsonencode
Expand Down Expand Up @@ -130,7 +130,7 @@ def _checkpoint(self, w):
if w.callback is not None:
try:
w.callback(response)
except Exception, e:
except Exception as e:
logger.exception("Callback for %s failed", w.url)

def _content_encode(self, qiter, w):
Expand Down
14 changes: 8 additions & 6 deletions hubstorage/utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import time
from Queue import Empty
import six
from six.moves.queue import Empty
from scrapy.utils.python import to_native_str


def urlpathjoin(*parts):
Expand Down Expand Up @@ -35,10 +37,10 @@ def urlpathjoin(*parts):
continue
elif isinstance(p, tuple):
p = urlpathjoin(*p)
elif isinstance(p, unicode):
p = p.encode('utf8')
elif not isinstance(p, str):
p = str(p)
elif isinstance(p, six.string_types):
p = to_native_str(p)
else:
p = to_native_str(str(p))

url = p if url is None else '{0}/{1}'.format(url.rstrip('/'), p)

Expand Down Expand Up @@ -81,7 +83,7 @@ class iterqueue(object):

it exposes an attribute "count" with the number of messages read

>>> from Queue import Queue
>>> from six.moves.queue import Queue
>>> q = Queue()
>>> for x in xrange(10):
... q.put(x)
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
requests>=1.0
retrying>=1.3.3
retrying>=1.3.3
six
scrapy
2 changes: 1 addition & 1 deletion tests/test_activity.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Test Activty
"""
from hstestcase import HSTestCase
from .hstestcase import HSTestCase


class ActivityTest(HSTestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_batchuploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"""
import time
from collections import defaultdict
from hstestcase import HSTestCase
from hubstorage import ValueTooLarge
from .hstestcase import HSTestCase


class BatchUploaderTest(HSTestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Test Client
"""
from hstestcase import HSTestCase
from .hstestcase import HSTestCase
from hubstorage.utils import millitime, apipoll

class ClientTest(HSTestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_frontier.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Test Frontier
"""
from hstestcase import HSTestCase
from .hstestcase import HSTestCase


class FrontierTest(HSTestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_jobq.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
Test JobQ
"""
import os, unittest
from hstestcase import HSTestCase
from hubstorage.jobq import DuplicateJobError
from hubstorage.utils import apipoll
from .hstestcase import HSTestCase


EXCLUSIVE = os.environ.get('EXCLUSIVE_STORAGE')
Expand Down
2 changes: 1 addition & 1 deletion tests/test_jobsmeta.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

System tests for operations on stored job metadata
"""
from hstestcase import HSTestCase
from .hstestcase import HSTestCase


class JobsMetadataTest(HSTestCase):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from requests.exceptions import HTTPError
from hubstorage import HubstorageClient
from hubstorage.utils import millitime
from hstestcase import HSTestCase
from testutil import failing_downloader
from .hstestcase import HSTestCase
from .testutil import failing_downloader


class ProjectTest(HSTestCase):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_retry.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
Test Retry Policy
"""
from httplib import BadStatusLine
from six.moves.http_client import BadStatusLine
from requests import HTTPError, ConnectionError
from hstestcase import HSTestCase
from hubstorage import HubstorageClient
from .hstestcase import HSTestCase
import responses
import json
import re
Expand Down
2 changes: 1 addition & 1 deletion tests/test_system.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import random
from contextlib import closing
from hstestcase import HSTestCase
from hubstorage import HubstorageClient
from hubstorage.utils import millitime
from .hstestcase import HSTestCase


class SystemTest(HSTestCase):
Expand Down