diff --git a/appengine/bigquery/tests/test_appengine_auth.py b/appengine/bigquery/main_test.py similarity index 98% rename from appengine/bigquery/tests/test_appengine_auth.py rename to appengine/bigquery/main_test.py index c8206c2cbb02..58e79a6a40fb 100644 --- a/appengine/bigquery/tests/test_appengine_auth.py +++ b/appengine/bigquery/main_test.py @@ -16,11 +16,12 @@ import re from apiclient.http import HttpMock -from appengine.bigquery import main import mock import tests import webtest +from . import main + class TestAuthSample(tests.AppEngineTestbedCase): diff --git a/appengine/bigquery/tests/__init__.py b/appengine/bigquery/tests/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/appengine/images/tests/test_guestbook.py b/appengine/images/main_test.py similarity index 97% rename from appengine/images/tests/test_guestbook.py rename to appengine/images/main_test.py index b13e42f1c49f..f1ed70690066 100644 --- a/appengine/images/tests/test_guestbook.py +++ b/appengine/images/main_test.py @@ -12,12 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -# from the app main.py -from appengine.images import main import mock from tests import AppEngineTestbedCase import webtest +from . import main + class TestHandlers(AppEngineTestbedCase): def setUp(self): diff --git a/appengine/images/tests/__init__.py b/appengine/images/tests/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/appengine/ndb/overview/tests/test_overview.py b/appengine/memcache/guestbook/main_test.py similarity index 93% rename from appengine/ndb/overview/tests/test_overview.py rename to appengine/memcache/guestbook/main_test.py index 2c43dab110f2..f6030adc9184 100644 --- a/appengine/ndb/overview/tests/test_overview.py +++ b/appengine/memcache/guestbook/main_test.py @@ -12,13 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -# from the app main.py -from appengine.ndb.overview import main from tests import AppEngineTestbedCase import webtest +from . import main + class TestHandlers(AppEngineTestbedCase): + def test_hello(self): app = webtest.TestApp(main.app) response = app.get('/') diff --git a/appengine/memcache/guestbook/tests/__init__.py b/appengine/memcache/guestbook/tests/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/appengine/ndb/modeling/tests/test_contact_with_group_models.py b/appengine/ndb/modeling/contact_with_group_models_test.py similarity index 96% rename from appengine/ndb/modeling/tests/test_contact_with_group_models.py rename to appengine/ndb/modeling/contact_with_group_models_test.py index 517bb56e0e34..e08a2980200b 100644 --- a/appengine/ndb/modeling/tests/test_contact_with_group_models.py +++ b/appengine/ndb/modeling/contact_with_group_models_test.py @@ -14,10 +14,11 @@ """Test classes for code snippet for modeling article.""" -from appengine.ndb.modeling import contact_with_group_models as models from google.appengine.ext import ndb from tests import AppEngineTestbedCase +from . import contact_with_group_models as models + class ContactTestCase(AppEngineTestbedCase): """A test case for the Contact model with groups.""" diff --git a/appengine/ndb/modeling/tests/test_keyproperty_models.py b/appengine/ndb/modeling/keyproperty_models_test.py similarity index 96% rename from appengine/ndb/modeling/tests/test_keyproperty_models.py rename to appengine/ndb/modeling/keyproperty_models_test.py index cb096d0b612e..2a119bb4d1a4 100644 --- a/appengine/ndb/modeling/tests/test_keyproperty_models.py +++ b/appengine/ndb/modeling/keyproperty_models_test.py @@ -16,9 +16,10 @@ import unittest -from appengine.ndb.modeling import keyproperty_models as models from tests import AppEngineTestbedCase +from . import keyproperty_models as models + class ContactTestCase(AppEngineTestbedCase): """A test case for the Contact model class with KeyProperty.""" diff --git a/appengine/ndb/modeling/tests/test_naive_models.py b/appengine/ndb/modeling/naive_models_test.py similarity index 95% rename from appengine/ndb/modeling/tests/test_naive_models.py rename to appengine/ndb/modeling/naive_models_test.py index 60a5109258c8..d54be0c49504 100644 --- a/appengine/ndb/modeling/tests/test_naive_models.py +++ b/appengine/ndb/modeling/naive_models_test.py @@ -14,9 +14,10 @@ """Test classes for code snippet for modeling article.""" -from appengine.ndb.modeling import naive_models as models from tests import AppEngineTestbedCase +from . import naive_models as models + class ContactTestCase(AppEngineTestbedCase): """A test case for the naive Contact model classe.""" diff --git a/appengine/ndb/modeling/tests/test_parent_child_models.py b/appengine/ndb/modeling/parent_child_models_test.py similarity index 97% rename from appengine/ndb/modeling/tests/test_parent_child_models.py rename to appengine/ndb/modeling/parent_child_models_test.py index f5710633a934..b76db71d9f5d 100644 --- a/appengine/ndb/modeling/tests/test_parent_child_models.py +++ b/appengine/ndb/modeling/parent_child_models_test.py @@ -14,10 +14,11 @@ """Test classes for code snippet for modeling article.""" -from appengine.ndb.modeling import parent_child_models as models from google.appengine.ext import ndb from tests import AppEngineTestbedCase +from . import parent_child_models as models + class ContactTestCase(AppEngineTestbedCase): """A test case for the Contact model class with KeyProperty.""" diff --git a/appengine/ndb/modeling/tests/test_relation_model_models.py b/appengine/ndb/modeling/relation_model_models_test.py similarity index 97% rename from appengine/ndb/modeling/tests/test_relation_model_models.py rename to appengine/ndb/modeling/relation_model_models_test.py index 5dd324b9b454..eb1f61f02a13 100644 --- a/appengine/ndb/modeling/tests/test_relation_model_models.py +++ b/appengine/ndb/modeling/relation_model_models_test.py @@ -14,10 +14,11 @@ """Test classes for code snippet for modeling article.""" -from appengine.ndb.modeling import relation_model_models as models from google.appengine.ext import ndb from tests import AppEngineTestbedCase +from . import relation_model_models as models + class ContactTestCase(AppEngineTestbedCase): """A test case for the Contact model with relationship model.""" diff --git a/appengine/ndb/modeling/tests/test_structured_property_models.py b/appengine/ndb/modeling/structured_property_models_test.py similarity index 97% rename from appengine/ndb/modeling/tests/test_structured_property_models.py rename to appengine/ndb/modeling/structured_property_models_test.py index e1c8be50c76c..28e65347618c 100644 --- a/appengine/ndb/modeling/tests/test_structured_property_models.py +++ b/appengine/ndb/modeling/structured_property_models_test.py @@ -14,9 +14,10 @@ """Test classes for code snippet for modeling article.""" -from appengine.ndb.modeling import structured_property_models as models from tests import AppEngineTestbedCase +from . import structured_property_models as models + class ContactTestCase(AppEngineTestbedCase): """A test case for the Contact model with StructuredProperty.""" diff --git a/appengine/ndb/modeling/tests/__init__.py b/appengine/ndb/modeling/tests/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/appengine/memcache/guestbook/tests/test_guestbook.py b/appengine/ndb/overview/main_test.py similarity index 92% rename from appengine/memcache/guestbook/tests/test_guestbook.py rename to appengine/ndb/overview/main_test.py index eedfc8ed47b8..41ae248c194f 100644 --- a/appengine/memcache/guestbook/tests/test_guestbook.py +++ b/appengine/ndb/overview/main_test.py @@ -12,14 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -# from the app main.py -from appengine.memcache.guestbook import main from tests import AppEngineTestbedCase import webtest +from . import main -class TestHandlers(AppEngineTestbedCase): +class TestHandlers(AppEngineTestbedCase): def test_hello(self): app = webtest.TestApp(main.app) response = app.get('/') diff --git a/appengine/ndb/overview/tests/__init__.py b/appengine/ndb/overview/tests/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/appengine/ndb/transactions/tests/test_transactions.py b/appengine/ndb/transactions/main_test.py similarity index 96% rename from appengine/ndb/transactions/tests/test_transactions.py rename to appengine/ndb/transactions/main_test.py index d81637291660..07442f86fd0f 100644 --- a/appengine/ndb/transactions/tests/test_transactions.py +++ b/appengine/ndb/transactions/main_test.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -# from the app main.py -from appengine.ndb.transactions import main from tests import AppEngineTestbedCase +from . import main + class TestHandlers(AppEngineTestbedCase): def setUp(self): diff --git a/appengine/ndb/transactions/tests/__init__.py b/appengine/ndb/transactions/tests/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/bigquery/tests/test_async_query.py b/bigquery/samples/async_query_test.py similarity index 95% rename from bigquery/tests/test_async_query.py rename to bigquery/samples/async_query_test.py index 8ea0abc293c1..5e6dbba2feea 100644 --- a/bigquery/tests/test_async_query.py +++ b/bigquery/samples/async_query_test.py @@ -13,9 +13,10 @@ # import json -from bigquery.samples.async_query import main import tests +from .async_query import main + class TestAsyncQuery(tests.CloudBaseTest): diff --git a/bigquery/tests/test_export_data_to_cloud_storage.py b/bigquery/samples/export_data_to_cloud_storage_test.py similarity index 96% rename from bigquery/tests/test_export_data_to_cloud_storage.py rename to bigquery/samples/export_data_to_cloud_storage_test.py index 97501bea2ce6..6ab4adbb3e89 100644 --- a/bigquery/tests/test_export_data_to_cloud_storage.py +++ b/bigquery/samples/export_data_to_cloud_storage_test.py @@ -13,9 +13,10 @@ # """Tests for export_table_to_gcs.""" -from bigquery.samples.export_data_to_cloud_storage import main from tests import CloudBaseTest +from .export_data_to_cloud_storage import main + class TestExportTableToGCS(CloudBaseTest): diff --git a/bigquery/tests/test_getting_started.py b/bigquery/samples/getting_started_test.py similarity index 89% rename from bigquery/tests/test_getting_started.py rename to bigquery/samples/getting_started_test.py index dbb4ff555a58..e2801e377d0b 100644 --- a/bigquery/tests/test_getting_started.py +++ b/bigquery/samples/getting_started_test.py @@ -13,14 +13,15 @@ # import re -from bigquery.samples import getting_started import tests +from .getting_started import main + class TestGettingStarted(tests.CloudBaseTest): def test_main(self): with tests.capture_stdout() as mock_stdout: - getting_started.main(self.constants['projectId']) + main(self.constants['projectId']) stdout = mock_stdout.getvalue() self.assertRegexpMatches(stdout, re.compile( diff --git a/bigquery/tests/test_list_datasets_projects.py b/bigquery/samples/list_datasets_projects_test.py similarity index 89% rename from bigquery/tests/test_list_datasets_projects.py rename to bigquery/samples/list_datasets_projects_test.py index 7dfcf39821b1..51c027db0176 100644 --- a/bigquery/tests/test_list_datasets_projects.py +++ b/bigquery/samples/list_datasets_projects_test.py @@ -13,15 +13,16 @@ # import re -from bigquery.samples import list_datasets_projects import tests +from .list_datasets_projects import main + class TestListDatasetsProjects(tests.CloudBaseTest): def test_main(self): with tests.capture_stdout() as mock_stdout: - list_datasets_projects.main(self.constants['projectId']) + main(self.constants['projectId']) stdout = mock_stdout.getvalue() diff --git a/bigquery/tests/test_load_data_from_csv.py b/bigquery/samples/load_data_from_csv_test.py similarity index 95% rename from bigquery/tests/test_load_data_from_csv.py rename to bigquery/samples/load_data_from_csv_test.py index a800c4be3e75..8cd51f696661 100644 --- a/bigquery/tests/test_load_data_from_csv.py +++ b/bigquery/samples/load_data_from_csv_test.py @@ -14,9 +14,10 @@ """Tests for load_data_from_csv.""" import os -from bigquery.samples.load_data_from_csv import main from tests import CloudBaseTest +from .load_data_from_csv import main + class TestLoadDataFromCSV(CloudBaseTest): def test_load_table(self): diff --git a/bigquery/tests/test_streaming.py b/bigquery/samples/streaming_test.py similarity index 97% rename from bigquery/tests/test_streaming.py rename to bigquery/samples/streaming_test.py index c29efa06e639..b6ad0cc62c5a 100644 --- a/bigquery/tests/test_streaming.py +++ b/bigquery/samples/streaming_test.py @@ -15,9 +15,10 @@ import json import os -from bigquery.samples import streaming from tests import capture_stdout, CloudBaseTest +from . import streaming + class TestStreaming(CloudBaseTest): diff --git a/bigquery/tests/test_sync_query.py b/bigquery/samples/sync_query_test.py similarity index 95% rename from bigquery/tests/test_sync_query.py rename to bigquery/samples/sync_query_test.py index f5ed3eadf42b..6123614d234a 100644 --- a/bigquery/tests/test_sync_query.py +++ b/bigquery/samples/sync_query_test.py @@ -13,9 +13,10 @@ # import json -from bigquery.samples.sync_query import main from tests import capture_stdout, CloudBaseTest +from .sync_query import main + class TestSyncQuery(CloudBaseTest): diff --git a/bigquery/tests/__init__.py b/bigquery/tests/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/blog/introduction_to_data_models_in_cloud_datastore/test_blog.py b/blog/introduction_to_data_models_in_cloud_datastore/blog_test.py similarity index 100% rename from blog/introduction_to_data_models_in_cloud_datastore/test_blog.py rename to blog/introduction_to_data_models_in_cloud_datastore/blog_test.py diff --git a/blog/introduction_to_data_models_in_cloud_datastore/test_wiki.py b/blog/introduction_to_data_models_in_cloud_datastore/wiki_test.py similarity index 100% rename from blog/introduction_to_data_models_in_cloud_datastore/test_wiki.py rename to blog/introduction_to_data_models_in_cloud_datastore/wiki_test.py diff --git a/compute/autoscaler/demo/tests/test_frontend.py b/compute/autoscaler/demo/frontend_test.py similarity index 98% rename from compute/autoscaler/demo/tests/test_frontend.py rename to compute/autoscaler/demo/frontend_test.py index 702371500b1d..6ef175faea08 100644 --- a/compute/autoscaler/demo/tests/test_frontend.py +++ b/compute/autoscaler/demo/frontend_test.py @@ -15,7 +15,7 @@ import unittest -from compute.autoscaler.demo import frontend +from . import frontend class FakeTime(object): diff --git a/compute/autoscaler/demo/tests/__init__.py b/compute/autoscaler/demo/tests/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/monitoring/samples/tests/test_auth.py b/monitoring/samples/auth_test.py similarity index 91% rename from monitoring/samples/tests/test_auth.py rename to monitoring/samples/auth_test.py index 2bc7d3b2eee5..90e6d8865eb2 100644 --- a/monitoring/samples/tests/test_auth.py +++ b/monitoring/samples/auth_test.py @@ -13,12 +13,11 @@ import os import re -import unittest - -from monitoring.samples import auth import tests +from . import auth + class TestTimeseriesList(tests.CloudBaseTest): @@ -34,7 +33,3 @@ def test_main(self): output, re.compile(r'Timeseries.list raw response:\s*' r'{\s*"kind": "[^"]+",' r'\s*"oldest": *"[0-9]+', re.S)) - - -if __name__ == '__main__': - unittest.main() diff --git a/monitoring/samples/tests/__init__.py b/monitoring/samples/tests/__init__.py deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/storage/api/test_compose_objects.py b/storage/api/compose_objects_test.py similarity index 99% rename from storage/api/test_compose_objects.py rename to storage/api/compose_objects_test.py index a44b2fc2b64d..695b1fad7ebb 100644 --- a/storage/api/test_compose_objects.py +++ b/storage/api/compose_objects_test.py @@ -13,9 +13,10 @@ # import os -from .compose_objects import main from tests import CloudBaseTest +from .compose_objects import main + class TestComposeObjects(CloudBaseTest): def test_main(self): diff --git a/storage/api/test_list_objects.py b/storage/api/list_objects_test.py similarity index 99% rename from storage/api/test_list_objects.py rename to storage/api/list_objects_test.py index 83842e5b171d..85b5bfb1ac93 100644 --- a/storage/api/test_list_objects.py +++ b/storage/api/list_objects_test.py @@ -11,9 +11,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .list_objects import main from tests import CloudBaseTest +from .list_objects import main + class TestListObjects(CloudBaseTest): def test_main(self):