Skip to content

Commit

Permalink
Using google-apitools in place of _gcloud_vendor.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhermes committed Apr 9, 2015
1 parent 1695de4 commit 79332e1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gcloud/storage/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def upload_from_file(self, file_obj, rewind=False, size=None,
# Should we be passing callbacks through from caller? We can't
# pass them as None, because apitools wants to print to the console
# by default.
if upload.strategy == transfer._RESUMABLE_UPLOAD:
if upload.strategy == transfer.RESUMABLE_UPLOAD:
http_response = upload.StreamInChunks(
callback=lambda *args: None,
finish_callback=lambda *args: None)
Expand Down
8 changes: 8 additions & 0 deletions gcloud/storage/test_blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,12 @@ def test_upload_from_file_w_slash_in_name(self):
fh.write(DATA)
fh.flush()
blob.upload_from_file(fh, rewind=True)
self.assertEqual(fh.tell(), len(DATA))
rq = connection.http._requested
self.assertEqual(len(rq), 1)
self.assertEqual(rq[0]['redirections'], 5)
self.assertEqual(rq[0]['body'], DATA)
self.assertEqual(rq[0]['connection_type'], None)
self.assertEqual(rq[0]['method'], 'POST')
uri = rq[0]['uri']
scheme, netloc, path, qs, _ = urlsplit(uri)
Expand Down Expand Up @@ -1052,7 +1056,11 @@ def build_api_url(self, path, query_params=None,

class _HTTP(_Responder):

connections = {} # For google-apitools debugging.

def request(self, uri, method, headers, body, **kw):
if hasattr(body, 'read'):
body = body.read()
return self._respond(uri=uri, method=method, headers=headers,
body=body, **kw)

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@


REQUIREMENTS = [
'google-apitools',
'httplib2',
'oauth2client >= 1.4.6',
'protobuf >= 2.5.0',
Expand Down
10 changes: 2 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ basepython =
commands =
nosetests --with-xunit --with-xcoverage --cover-package=gcloud --nocapture --cover-erase --cover-tests --cover-branches --cover-min-percentage=100
deps =
nose
unittest2
protobuf>=3.0.0-alpha-1
{[testenv]deps}
coverage
nosexcover

Expand Down Expand Up @@ -63,19 +61,15 @@ basepython =
python2.7
commands =
{toxinidir}/scripts/run_regression.sh
deps =
unittest2
protobuf>=3.0.0-alpha-1

[testenv:regression3]
basepython =
python3.4
commands =
{toxinidir}/scripts/run_regression.sh
deps =
unittest2
{[testenv]deps}
# Use a development checkout of httplib2 until a release is made
# incorporating https://github.com/jcgregorio/httplib2/pull/291
# and https://github.com/jcgregorio/httplib2/pull/296
-egit+https://github.com/jcgregorio/httplib2.git#egg=httplib2
protobuf>=3.0.0-alpha-1

0 comments on commit 79332e1

Please sign in to comment.