Skip to content

Commit

Permalink
Fixing pep8, removing mock_input_answers
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Wayne Parrott committed Sep 14, 2015
1 parent d2b414b commit 0efc8c9
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 29 deletions.
2 changes: 1 addition & 1 deletion bigquery/samples/load_data_by_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
import argparse
import json

from utils import get_service, poll_job
import httplib2
from oauth2client.client import GoogleCredentials
from utils import get_service, poll_job


# [START make_post]
Expand Down
2 changes: 1 addition & 1 deletion bigquery/samples/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import json
import uuid

from utils import get_service
from six.moves import input
from utils import get_service


# [START stream_row_to_bigquery]
Expand Down
2 changes: 1 addition & 1 deletion bigquery/tests/test_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import os

from bigquery.samples import streaming
from tests import CloudBaseTest, capture_stdout
from tests import capture_stdout, CloudBaseTest


class TestStreaming(CloudBaseTest):
Expand Down
2 changes: 1 addition & 1 deletion bigquery/tests/test_sync_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import json

from bigquery.samples.sync_query import main
from tests import CloudBaseTest, capture_stdout
from tests import capture_stdout, CloudBaseTest


class TestSyncQuery(CloudBaseTest):
Expand Down
2 changes: 0 additions & 2 deletions tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
BUCKET_NAME_ENV,
capture_stdout,
CloudBaseTest,
mock_input_answers,
PROJECT_ID_ENV,
RESOURCE_PATH)

Expand All @@ -27,7 +26,6 @@
'BUCKET_NAME_ENV',
'capture_stdout',
'CloudBaseTest',
'mock_input_answers',
'PROJECT_ID_ENV',
'RESOURCE_PATH'
]
23 changes: 0 additions & 23 deletions tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import tempfile
import unittest

from mock import patch
from nose.plugins.skip import SkipTest
from six.moves import cStringIO

Expand All @@ -39,28 +38,6 @@
os.path.abspath(os.path.dirname(__file__)), 'resources')


# TODO: This can be written as a much simpler context manager.
class mock_input_answers(object):

def __init__(self, list_, target):
self.i = 0
self.list_ = list_
self.target = target

def get_next_value(self, question):
ret = self.list_[self.i]
self.i += 1
print('Responding to {} with {}'.format(question, ret))
return u"{}".format(ret)

def __enter__(self):
self.patch = patch(self.target, self.get_next_value)
self.patch.__enter__()

def __exit__(self, exc_type, exc_value, traceback):
self.patch.__exit__(exc_type, exc_value, traceback)


class CloudBaseTest(unittest.TestCase):

def setUp(self):
Expand Down

0 comments on commit 0efc8c9

Please sign in to comment.