Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 95d112e

Browse filesBrowse files
author
Jon Wayne Parrott
committed
Merge pull request GoogleCloudPlatform#185 from GoogleCloudPlatform/pytest
Moving to py.test test runner
2 parents 886fa25 + d9ce5d1 commit 95d112e
Copy full SHA for 95d112e

File tree

Expand file treeCollapse file tree

125 files changed

+299
-230
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

125 files changed

+299
-230
lines changed

‎.gitignore

Copy file name to clipboardExpand all lines: .gitignore
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ lib
1616
testing/resources/test-env.sh
1717
testing/resources/service-account.json
1818
secrets.tar
19+
.cache
20+
junit.xml

‎.travis.yml

Copy file name to clipboardExpand all lines: .travis.yml
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ before_install:
1919
- openssl aes-256-cbc -k "$secrets_password" -in secrets.tar.enc -out secrets.tar -d
2020
- tar xvf secrets.tar
2121
install:
22-
- pip install tox
22+
- pip install tox coverage
2323
- pip install -e git+https://github.com/GoogleCloudPlatform/python-repo-tools#egg=python-repo-tools
2424
- gcp-python-repo-tools download-appengine-sdk `dirname "${GAE_PYTHONPATH}"`
2525
script:
2626
- source ${TRAVIS_BUILD_DIR}/testing/resources/test-env.sh
2727
- tox
28+
- coverage report

‎appengine/__init__.py

Copy file name to clipboardExpand all lines: appengine/__init__.py
Whitespace-only changes.

‎appengine/app_identity/__init__.py

Copy file name to clipboardExpand all lines: appengine/app_identity/__init__.py
Whitespace-only changes.

‎appengine/app_identity/signing/__init__.py

Copy file name to clipboardExpand all lines: appengine/app_identity/signing/__init__.py
Whitespace-only changes.

‎appengine/app_identity/signing/main_test.py

Copy file name to clipboardExpand all lines: appengine/app_identity/signing/main_test.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import main
1516
from testing import AppEngineTest
1617
import webtest
1718

18-
from . import main
19-
2019

2120
class TestAppIdentityHandler(AppEngineTest):
2221
def setUp(self):

‎appengine/bigquery/__init__.py

Copy file name to clipboardExpand all lines: appengine/bigquery/__init__.py
Whitespace-only changes.

‎appengine/bigquery/main.py

Copy file name to clipboardExpand all lines: appengine/bigquery/main.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14+
1415
# [START all]
1516

1617
"""

‎appengine/bigquery/main_test.py

Copy file name to clipboardExpand all lines: appengine/bigquery/main_test.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@
1515
import re
1616

1717
from apiclient.http import HttpMock
18+
import main
1819
import mock
1920
import testing
2021
import webtest
2122

22-
from . import main
23-
2423

2524
class TestAuthSample(testing.AppEngineTest):
2625

‎appengine/blobstore/__init__.py

Copy file name to clipboardExpand all lines: appengine/blobstore/__init__.py
Whitespace-only changes.

‎appengine/blobstore/main_test.py

Copy file name to clipboardExpand all lines: appengine/blobstore/main_test.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import main
1516
import testing
1617
import webtest
1718

18-
from . import main
19-
2019

2120
class TestBlobstoreSample(testing.AppEngineTest):
2221

‎appengine/cloudsql/__init__.py

Copy file name to clipboardExpand all lines: appengine/cloudsql/__init__.py
Whitespace-only changes.

‎appengine/cloudsql/main_test.py

Copy file name to clipboardExpand all lines: appengine/cloudsql/main_test.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@
1616
import re
1717
from unittest.case import SkipTest
1818

19+
import main
1920
import testing
2021
import webtest
2122

22-
from . import main
23-
2423

2524
class TestMySQLSample(testing.AppEngineTest):
2625

‎appengine/conftest.py

Copy file name to clipboard
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import testing.appengine
2+
3+
4+
def pytest_configure(config):
5+
testing.appengine.setup_sdk_imports()
6+
7+
8+
def pytest_runtest_call(item):
9+
testing.appengine.import_appengine_config()

‎appengine/i18n/__init__.py

Copy file name to clipboardExpand all lines: appengine/i18n/__init__.py
Whitespace-only changes.

‎appengine/images/__init__.py

Copy file name to clipboardExpand all lines: appengine/images/__init__.py
Whitespace-only changes.

‎appengine/images/main_test.py

Copy file name to clipboardExpand all lines: appengine/images/main_test.py
+3-8Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,15 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import main
1516
import mock
1617
from testing import AppEngineTest
1718
import webtest
1819

19-
from . import main
20-
2120

2221
class TestHandlers(AppEngineTest):
2322
def setUp(self):
2423
super(TestHandlers, self).setUp()
25-
26-
# Workaround for other tests clobbering our Greeting model.
27-
reload(main)
28-
2924
self.app = webtest.TestApp(main.app)
3025

3126
def test_get(self):
@@ -40,7 +35,7 @@ def test_get(self):
4035
# Let's check if the response is correct.
4136
self.assertEqual(response.status_int, 200)
4237

43-
@mock.patch('appengine.images.main.images')
38+
@mock.patch('main.images')
4439
def test_post(self, mock_images):
4540
mock_images.resize.return_value = 'asdf'
4641

@@ -68,7 +63,7 @@ def test_img_missing(self):
6863
# Bogus image id, should get error
6964
self.app.get('/img?img_id=123', status=500)
7065

71-
@mock.patch('appengine.images.main.images')
66+
@mock.patch('main.images')
7267
def test_post_and_get(self, mock_images):
7368
mock_images.resize.return_value = 'asdf'
7469

‎appengine/localtesting/__init__.py

Copy file name to clipboardExpand all lines: appengine/localtesting/__init__.py
Whitespace-only changes.

‎appengine/logging/__init__.py

Copy file name to clipboardExpand all lines: appengine/logging/__init__.py
Whitespace-only changes.

‎appengine/logging/reading_logs/__init__.py

Copy file name to clipboardExpand all lines: appengine/logging/reading_logs/__init__.py
Whitespace-only changes.

‎appengine/logging/reading_logs/main_test.py

Copy file name to clipboardExpand all lines: appengine/logging/reading_logs/main_test.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import main
1516
from testing import AppEngineTest
1617
import webtest
1718

18-
from . import main
19-
2019

2120
class TestReadingLogs(AppEngineTest):
2221
def setUp(self):

‎appengine/logging/writing_logs/__init__.py

Copy file name to clipboardExpand all lines: appengine/logging/writing_logs/__init__.py
Whitespace-only changes.

‎appengine/logging/writing_logs/main_test.py

Copy file name to clipboardExpand all lines: appengine/logging/writing_logs/main_test.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import main
1516
from testing import AppEngineTest
1617
import webtest
1718

18-
from . import main
19-
2019

2120
class TestWritingLogs(AppEngineTest):
2221
def setUp(self):

‎appengine/mailgun/__init__.py

Copy file name to clipboardExpand all lines: appengine/mailgun/__init__.py
Whitespace-only changes.

‎appengine/mailgun/main_test.py

Copy file name to clipboardExpand all lines: appengine/mailgun/main_test.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import main
1516
from testing import AppEngineTest, Http2Mock
1617
import webtest
1718

18-
from . import main
19-
2019

2120
class TestMailgunHandlers(AppEngineTest):
2221
def setUp(self):

‎appengine/memcache/__init__.py

Copy file name to clipboardExpand all lines: appengine/memcache/__init__.py
Whitespace-only changes.

‎appengine/memcache/guestbook/__init__.py

Copy file name to clipboardExpand all lines: appengine/memcache/guestbook/__init__.py
Whitespace-only changes.

‎appengine/memcache/guestbook/main_test.py

Copy file name to clipboardExpand all lines: appengine/memcache/guestbook/main_test.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
16+
import main
1517
from testing import AppEngineTest
1618
import webtest
1719

18-
from . import main
19-
2020

2121
class TestHandlers(AppEngineTest):
2222

‎appengine/multitenancy/__init__.py

Copy file name to clipboardExpand all lines: appengine/multitenancy/__init__.py
Whitespace-only changes.

‎appengine/multitenancy/datastore_test.py

Copy file name to clipboardExpand all lines: appengine/multitenancy/datastore_test.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import datastore
1516
import testing
1617
import webtest
1718

18-
from . import datastore
19-
2019

2120
class TestNamespaceDatastoreSample(testing.AppEngineTest):
2221

‎appengine/multitenancy/memcache_test.py

Copy file name to clipboardExpand all lines: appengine/multitenancy/memcache_test.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import memcache
1516
import testing
1617
import webtest
1718

18-
from . import memcache
19-
2019

2120
class TestNamespaceMemcacheSample(testing.AppEngineTest):
2221

‎appengine/multitenancy/taskqueue_test.py

Copy file name to clipboardExpand all lines: appengine/multitenancy/taskqueue_test.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import taskqueue
1516
import testing
1617
import webtest
1718

18-
from . import taskqueue
19-
2019

2120
class TestNamespaceTaskQueueSample(testing.AppEngineTest):
2221

‎appengine/ndb/__init__.py

Copy file name to clipboardExpand all lines: appengine/ndb/__init__.py
Whitespace-only changes.

‎appengine/ndb/modeling/__init__.py

Copy file name to clipboardExpand all lines: appengine/ndb/modeling/__init__.py
Whitespace-only changes.

‎appengine/ndb/modeling/contact_with_group_models_test.py

Copy file name to clipboardExpand all lines: appengine/ndb/modeling/contact_with_group_models_test.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414

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

17+
import contact_with_group_models as models
1718
from google.appengine.ext import ndb
1819
from testing import AppEngineTest
1920

20-
from . import contact_with_group_models as models
21-
2221

2322
class ContactTestCase(AppEngineTest):
2423
"""A test case for the Contact model with groups."""

‎appengine/ndb/modeling/keyproperty_models_test.py

Copy file name to clipboardExpand all lines: appengine/ndb/modeling/keyproperty_models_test.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616

1717
import unittest
1818

19+
import keyproperty_models as models
1920
from testing import AppEngineTest
2021

21-
from . import keyproperty_models as models
22-
2322

2423
class ContactTestCase(AppEngineTest):
2524
"""A test case for the Contact model class with KeyProperty."""

‎appengine/ndb/modeling/naive_models_test.py

Copy file name to clipboardExpand all lines: appengine/ndb/modeling/naive_models_test.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414

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

17+
import naive_models as models
1718
from testing import AppEngineTest
1819

19-
from . import naive_models as models
20-
2120

2221
class ContactTestCase(AppEngineTest):
2322
"""A test case for the naive Contact model classe."""

‎appengine/ndb/modeling/parent_child_models_test.py

Copy file name to clipboardExpand all lines: appengine/ndb/modeling/parent_child_models_test.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
"""Test classes for code snippet for modeling article."""
1616

1717
from google.appengine.ext import ndb
18+
import parent_child_models as models
1819
from testing import AppEngineTest
1920

20-
from . import parent_child_models as models
21-
2221

2322
class ContactTestCase(AppEngineTest):
2423
"""A test case for the Contact model class with KeyProperty."""

‎appengine/ndb/modeling/relation_model_models_test.py

Copy file name to clipboardExpand all lines: appengine/ndb/modeling/relation_model_models_test.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
"""Test classes for code snippet for modeling article."""
1616

1717
from google.appengine.ext import ndb
18+
import relation_model_models as models
1819
from testing import AppEngineTest
1920

20-
from . import relation_model_models as models
21-
2221

2322
class ContactTestCase(AppEngineTest):
2423
"""A test case for the Contact model with relationship model."""

‎appengine/ndb/modeling/structured_property_models_test.py

Copy file name to clipboardExpand all lines: appengine/ndb/modeling/structured_property_models_test.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414

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

17+
import structured_property_models as models
1718
from testing import AppEngineTest
1819

19-
from . import structured_property_models as models
20-
2120

2221
class ContactTestCase(AppEngineTest):
2322
"""A test case for the Contact model with StructuredProperty."""

‎appengine/ndb/overview/__init__.py

Copy file name to clipboardExpand all lines: appengine/ndb/overview/__init__.py
Whitespace-only changes.

‎appengine/ndb/overview/main_test.py

Copy file name to clipboardExpand all lines: appengine/ndb/overview/main_test.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import main
1516
from testing import AppEngineTest
1617
import webtest
1718

18-
from . import main
19-
2019

2120
class TestHandlers(AppEngineTest):
2221
def test_hello(self):

‎appengine/ndb/transactions/__init__.py

Copy file name to clipboardExpand all lines: appengine/ndb/transactions/__init__.py
Whitespace-only changes.

‎appengine/ndb/transactions/main_test.py

Copy file name to clipboardExpand all lines: appengine/ndb/transactions/main_test.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import main
1516
from testing import AppEngineTest
1617

17-
from . import main
18-
1918

2019
class TestHandlers(AppEngineTest):
2120
def setUp(self):

‎appengine/storage/__init__.py

Copy file name to clipboardExpand all lines: appengine/storage/__init__.py
Whitespace-only changes.

‎appengine/storage/main_test.py

Copy file name to clipboardExpand all lines: appengine/storage/main_test.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@
1313
# limitations under the License.
1414
import re
1515

16+
import main
1617
import testing
1718
import webtest
1819

19-
from . import main
20-
2120

2221
class TestStorageSample(testing.AppEngineTest):
2322

‎bigquery/__init__.py

Copy file name to clipboardExpand all lines: bigquery/__init__.py
Whitespace-only changes.

‎bigquery/api/__init__.py

Copy file name to clipboardExpand all lines: bigquery/api/__init__.py
Whitespace-only changes.

‎bigquery/api/async_query_test.py

Copy file name to clipboardExpand all lines: bigquery/api/async_query_test.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
13-
#
13+
1414
import json
1515

16+
from async_query import main
1617
import testing
1718

18-
from .async_query import main
19-
2019

2120
class TestAsyncQuery(testing.CloudTest):
2221

‎bigquery/api/export_data_to_cloud_storage_test.py

Copy file name to clipboardExpand all lines: bigquery/api/export_data_to_cloud_storage_test.py
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,13 @@
1010
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
13-
#
1413

15-
"""Tests for export_table_to_gcs."""
16-
from nose.plugins.attrib import attr
14+
from export_data_to_cloud_storage import main
15+
import pytest
1716
from testing import CloudTest
1817

19-
from .export_data_to_cloud_storage import main
20-
2118

22-
@attr('slow')
19+
@pytest.mark.slow
2320
class TestExportTableToGCS(CloudTest):
2421
dataset_id = 'test_dataset'
2522
table_id = 'test_table'

‎bigquery/api/getting_started_test.py

Copy file name to clipboardExpand all lines: bigquery/api/getting_started_test.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
13-
#
13+
1414
import re
1515

16+
from getting_started import main
1617
import testing
1718

18-
from .getting_started import main
19-
2019

2120
class TestGettingStarted(testing.CloudTest):
2221
def test_main(self):

‎bigquery/api/list_datasets_projects_test.py

Copy file name to clipboardExpand all lines: bigquery/api/list_datasets_projects_test.py
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@
1010
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1111
# See the License for the specific language governing permissions and
1212
# limitations under the License.
13-
#
13+
1414
import re
1515

16+
from list_datasets_projects import main
1617
import testing
1718

18-
from .list_datasets_projects import main
19-
2019

2120
class TestListDatasetsProjects(testing.CloudTest):
2221

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.