Skip to content

Commit 1bfaa4d

Browse files
author
Takashi Matsuo
committed
Merge pull request #95 from GoogleCloudPlatform/test-reorg
Re-organizing tests to be beside the samples they test.
2 parents 75969d8 + 64d99cd commit 1bfaa4d

33 files changed

+46
-35
lines changed

appengine/bigquery/tests/test_appengine_auth.py renamed to appengine/bigquery/main_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616
import re
1717

1818
from apiclient.http import HttpMock
19-
from appengine.bigquery import main
2019
import mock
2120
import tests
2221
import webtest
2322

23+
from . import main
24+
2425

2526
class TestAuthSample(tests.AppEngineTestbedCase):
2627

appengine/bigquery/tests/__init__.py

Whitespace-only changes.

appengine/images/tests/test_guestbook.py renamed to appengine/images/main_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# from the app main.py
16-
from appengine.images import main
1715
import mock
1816
from tests import AppEngineTestbedCase
1917
import webtest
2018

19+
from . import main
20+
2121

2222
class TestHandlers(AppEngineTestbedCase):
2323
def setUp(self):

appengine/images/tests/__init__.py

Whitespace-only changes.

appengine/ndb/overview/tests/test_overview.py renamed to appengine/memcache/guestbook/main_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# from the app main.py
16-
from appengine.ndb.overview import main
1715
from tests import AppEngineTestbedCase
1816
import webtest
1917

18+
from . import main
19+
2020

2121
class TestHandlers(AppEngineTestbedCase):
22+
2223
def test_hello(self):
2324
app = webtest.TestApp(main.app)
2425
response = app.get('/')

appengine/memcache/guestbook/tests/__init__.py

Whitespace-only changes.

appengine/ndb/modeling/tests/test_contact_with_group_models.py renamed to appengine/ndb/modeling/contact_with_group_models_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414

1515
"""Test classes for code snippet for modeling article."""
1616

17-
from appengine.ndb.modeling import contact_with_group_models as models
1817
from google.appengine.ext import ndb
1918
from tests import AppEngineTestbedCase
2019

20+
from . import contact_with_group_models as models
21+
2122

2223
class ContactTestCase(AppEngineTestbedCase):
2324
"""A test case for the Contact model with groups."""

appengine/ndb/modeling/tests/test_keyproperty_models.py renamed to appengine/ndb/modeling/keyproperty_models_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616

1717
import unittest
1818

19-
from appengine.ndb.modeling import keyproperty_models as models
2019
from tests import AppEngineTestbedCase
2120

21+
from . import keyproperty_models as models
22+
2223

2324
class ContactTestCase(AppEngineTestbedCase):
2425
"""A test case for the Contact model class with KeyProperty."""

appengine/ndb/modeling/tests/test_naive_models.py renamed to appengine/ndb/modeling/naive_models_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414

1515
"""Test classes for code snippet for modeling article."""
1616

17-
from appengine.ndb.modeling import naive_models as models
1817
from tests import AppEngineTestbedCase
1918

19+
from . import naive_models as models
20+
2021

2122
class ContactTestCase(AppEngineTestbedCase):
2223
"""A test case for the naive Contact model classe."""

appengine/ndb/modeling/tests/test_parent_child_models.py renamed to appengine/ndb/modeling/parent_child_models_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414

1515
"""Test classes for code snippet for modeling article."""
1616

17-
from appengine.ndb.modeling import parent_child_models as models
1817
from google.appengine.ext import ndb
1918
from tests import AppEngineTestbedCase
2019

20+
from . import parent_child_models as models
21+
2122

2223
class ContactTestCase(AppEngineTestbedCase):
2324
"""A test case for the Contact model class with KeyProperty."""

appengine/ndb/modeling/tests/test_relation_model_models.py renamed to appengine/ndb/modeling/relation_model_models_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414

1515
"""Test classes for code snippet for modeling article."""
1616

17-
from appengine.ndb.modeling import relation_model_models as models
1817
from google.appengine.ext import ndb
1918
from tests import AppEngineTestbedCase
2019

20+
from . import relation_model_models as models
21+
2122

2223
class ContactTestCase(AppEngineTestbedCase):
2324
"""A test case for the Contact model with relationship model."""

appengine/ndb/modeling/tests/test_structured_property_models.py renamed to appengine/ndb/modeling/structured_property_models_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414

1515
"""Test classes for code snippet for modeling article."""
1616

17-
from appengine.ndb.modeling import structured_property_models as models
1817
from tests import AppEngineTestbedCase
1918

19+
from . import structured_property_models as models
20+
2021

2122
class ContactTestCase(AppEngineTestbedCase):
2223
"""A test case for the Contact model with StructuredProperty."""

appengine/ndb/modeling/tests/__init__.py

Whitespace-only changes.

appengine/memcache/guestbook/tests/test_guestbook.py renamed to appengine/ndb/overview/main_test.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# from the app main.py
16-
from appengine.memcache.guestbook import main
1715
from tests import AppEngineTestbedCase
1816
import webtest
1917

18+
from . import main
2019

21-
class TestHandlers(AppEngineTestbedCase):
2220

21+
class TestHandlers(AppEngineTestbedCase):
2322
def test_hello(self):
2423
app = webtest.TestApp(main.app)
2524
response = app.get('/')

appengine/ndb/overview/tests/__init__.py

Whitespace-only changes.

appengine/ndb/transactions/tests/test_transactions.py renamed to appengine/ndb/transactions/main_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# from the app main.py
16-
from appengine.ndb.transactions import main
1715
from tests import AppEngineTestbedCase
1816

17+
from . import main
18+
1919

2020
class TestHandlers(AppEngineTestbedCase):
2121
def setUp(self):

appengine/ndb/transactions/tests/__init__.py

Whitespace-only changes.

bigquery/tests/test_async_query.py renamed to bigquery/samples/async_query_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
#
1414
import json
1515

16-
from bigquery.samples.async_query import main
1716
import tests
1817

18+
from .async_query import main
19+
1920

2021
class TestAsyncQuery(tests.CloudBaseTest):
2122

bigquery/tests/test_export_data_to_cloud_storage.py renamed to bigquery/samples/export_data_to_cloud_storage_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
#
1414

1515
"""Tests for export_table_to_gcs."""
16-
from bigquery.samples.export_data_to_cloud_storage import main
1716
from tests import CloudBaseTest
1817

18+
from .export_data_to_cloud_storage import main
19+
1920

2021
class TestExportTableToGCS(CloudBaseTest):
2122

bigquery/tests/test_getting_started.py renamed to bigquery/samples/getting_started_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
#
1414
import re
1515

16-
from bigquery.samples import getting_started
1716
import tests
1817

18+
from .getting_started import main
19+
1920

2021
class TestGettingStarted(tests.CloudBaseTest):
2122
def test_main(self):
2223
with tests.capture_stdout() as mock_stdout:
23-
getting_started.main(self.constants['projectId'])
24+
main(self.constants['projectId'])
2425

2526
stdout = mock_stdout.getvalue()
2627
self.assertRegexpMatches(stdout, re.compile(

bigquery/tests/test_list_datasets_projects.py renamed to bigquery/samples/list_datasets_projects_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,16 @@
1313
#
1414
import re
1515

16-
from bigquery.samples import list_datasets_projects
1716
import tests
1817

18+
from .list_datasets_projects import main
19+
1920

2021
class TestListDatasetsProjects(tests.CloudBaseTest):
2122

2223
def test_main(self):
2324
with tests.capture_stdout() as mock_stdout:
24-
list_datasets_projects.main(self.constants['projectId'])
25+
main(self.constants['projectId'])
2526

2627
stdout = mock_stdout.getvalue()
2728

bigquery/tests/test_load_data_from_csv.py renamed to bigquery/samples/load_data_from_csv_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
"""Tests for load_data_from_csv."""
1515
import os
1616

17-
from bigquery.samples.load_data_from_csv import main
1817
from tests import CloudBaseTest
1918

19+
from .load_data_from_csv import main
20+
2021

2122
class TestLoadDataFromCSV(CloudBaseTest):
2223
def test_load_table(self):

bigquery/tests/test_streaming.py renamed to bigquery/samples/streaming_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
import json
1616
import os
1717

18-
from bigquery.samples import streaming
1918
from tests import capture_stdout, CloudBaseTest
2019

20+
from . import streaming
21+
2122

2223
class TestStreaming(CloudBaseTest):
2324

bigquery/tests/test_sync_query.py renamed to bigquery/samples/sync_query_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
#
1414
import json
1515

16-
from bigquery.samples.sync_query import main
1716
from tests import capture_stdout, CloudBaseTest
1817

18+
from .sync_query import main
19+
1920

2021
class TestSyncQuery(CloudBaseTest):
2122

bigquery/tests/__init__.py

Whitespace-only changes.

compute/autoscaler/demo/tests/test_frontend.py renamed to compute/autoscaler/demo/frontend_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
import unittest
1717

18-
from compute.autoscaler.demo import frontend
18+
from . import frontend
1919

2020

2121
class FakeTime(object):

compute/autoscaler/demo/tests/__init__.py

Whitespace-only changes.

monitoring/samples/tests/test_auth.py renamed to monitoring/samples/auth_test.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,11 @@
1313

1414
import os
1515
import re
16-
import unittest
17-
18-
from monitoring.samples import auth
1916

2017
import tests
2118

19+
from . import auth
20+
2221

2322
class TestTimeseriesList(tests.CloudBaseTest):
2423

@@ -34,7 +33,3 @@ def test_main(self):
3433
output, re.compile(r'Timeseries.list raw response:\s*'
3534
r'{\s*"kind": "[^"]+",'
3635
r'\s*"oldest": *"[0-9]+', re.S))
37-
38-
39-
if __name__ == '__main__':
40-
unittest.main()

monitoring/samples/tests/__init__.py

Whitespace-only changes.

storage/api/test_compose_objects.py renamed to storage/api/compose_objects_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
#
1414
import os
1515

16-
from .compose_objects import main
1716
from tests import CloudBaseTest
1817

18+
from .compose_objects import main
19+
1920

2021
class TestComposeObjects(CloudBaseTest):
2122
def test_main(self):

storage/api/test_list_objects.py renamed to storage/api/list_objects_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
1313
#
14-
from .list_objects import main
1514
from tests import CloudBaseTest
1615

16+
from .list_objects import main
17+
1718

1819
class TestListObjects(CloudBaseTest):
1920
def test_main(self):

0 commit comments

Comments
 (0)