Skip to content

Re-organizing some test stuff. #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2015
Merged
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
19 changes: 0 additions & 19 deletions bigquery/test/__init__.py

This file was deleted.

49 changes: 0 additions & 49 deletions bigquery/test/base_test.py

This file was deleted.

Empty file added bigquery/tests/__init__.py
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
import unittest

from bigquery.samples.async_query import run
from bigquery.test.base_test import BaseBigqueryTest
from tests import CloudBaseTest


class TestAsyncQuery(BaseBigqueryTest):
class TestAsyncQuery(CloudBaseTest):

def test_async_query(self):
for result in run(self.constants['projectId'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
import unittest

from bigquery.samples.export_data_to_cloud_storage import run
from bigquery.test.base_test import BaseBigqueryTest
from tests import CloudBaseTest


class TestExportTableToGCS(BaseBigqueryTest):
class TestExportTableToGCS(CloudBaseTest):

def test_export_table(self):
run(self.constants['cloudStorageInputURI'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,15 @@
import unittest

from bigquery.samples.load_data_from_csv import run
from bigquery.test import RESOURCE_PATH
from bigquery.test.base_test import BaseBigqueryTest
from tests import CloudBaseTest


class TestLoadDataFromCSV(BaseBigqueryTest):
class TestLoadDataFromCSV(CloudBaseTest):

def setUp(self):
super(TestLoadDataFromCSV, self).setUp()
with open(
os.path.join(RESOURCE_PATH, 'schema.json'),
os.path.join(self.resource_path, 'schema.json'),
'r') as schema_file:
self.schema = json.load(schema_file)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@
import unittest

from bigquery.samples.streaming import run
from bigquery.test import RESOURCE_PATH
from bigquery.test.base_test import BaseBigqueryTest
from tests import CloudBaseTest


class TestStreaming(BaseBigqueryTest):
class TestStreaming(CloudBaseTest):

def test_stream_row_to_bigquery(self):

with open(
os.path.join(RESOURCE_PATH, 'streamrows.json'),
os.path.join(self.resource_path, 'streamrows.json'),
'r') as rows_file:

rows = json.load(rows_file)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
import unittest

from bigquery.samples.sync_query import run
from bigquery.test.base_test import BaseBigqueryTest
from tests import CloudBaseTest


class TestSyncQuery(BaseBigqueryTest):
class TestSyncQuery(CloudBaseTest):

def test_sync_query(self):
for result in run(self.constants['projectId'],
Expand Down
2 changes: 1 addition & 1 deletion storage/tests/test_list_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ def test_main(self):
'ignored_command_name',
self.constants['bucketName']
]
self.assertNotRaises(main(args))
main(args)
5 changes: 4 additions & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@

BUCKET_NAME_ENV = 'TEST_BUCKET_NAME'
PROJECT_ID_ENV = 'TEST_PROJECT_ID'
RESOURCE_PATH = os.path.join(os.getcwd(), 'resources')
RESOURCE_PATH = os.path.join(
os.path.abspath(os.path.dirname(__file__)), 'resources')


class CloudBaseTest(unittest.TestCase):

def setUp(self):
self.resource_path = RESOURCE_PATH

# A hack to prevent get_application_default from going GAE route.
self._server_software_org = os.environ.get('SERVER_SOFTWARE')
os.environ['SERVER_SOFTWARE'] = ''
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ commands =
cover: --cover-tests --cover-branches --cover-min-percentage=70 \
cover: --cover-inclusive --cover-erase
cover: coveralls
nosetest: nosetests --with-gae
nosetest: nosetests --with-gae {posargs}
pep8: flake8 --max-complexity=10 --import-order-style=google