Skip to content
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

Re-organizing tests to be beside the samples they test. #95

Merged
merged 1 commit into from
Sep 16, 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
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Empty file removed appengine/images/tests/__init__.py
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -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('/')
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why this line is shown in the diff.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shrugs, me either. I didn't change it.

def test_hello(self):
app = webtest.TestApp(main.app)
response = app.get('/')
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
#
import json

from bigquery.samples.async_query import main
import tests

from .async_query import main


class TestAsyncQuery(tests.CloudBaseTest):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down
Empty file removed bigquery/tests/__init__.py
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import unittest

from compute.autoscaler.demo import frontend
from . import frontend


class FakeTime(object):
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@

import os
import re
import unittest

from monitoring.samples import auth

import tests

from . import auth


class TestTimeseriesList(tests.CloudBaseTest):

Expand All @@ -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()
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down