From 6b88b1bf1255c655d9a9cbcd929b9c242ea97794 Mon Sep 17 00:00:00 2001 From: Jon Wayne Parrott Date: Fri, 19 Aug 2016 13:56:18 -0700 Subject: [PATCH 1/4] Make lint check each sample individually to enforce proper import order Change-Id: I788d96f20c2f3a5f6bab6aab1d97daf184fc4a82 --- nox.py | 81 +++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 52 insertions(+), 29 deletions(-) diff --git a/nox.py b/nox.py index 2c9e53b4fda..8aba6fa0eb4 100644 --- a/nox.py +++ b/nox.py @@ -49,6 +49,9 @@ # Libraries that only work on Python 2.7 PY27_ONLY_LIBRARIES = ['mysql-python'] +# Whether we're running on Travis CI +ON_TRAVIS = os.environ.get('TRAVIS', False) + def list_files(folder, pattern): """Lists all files below the given folder that match the pattern.""" @@ -136,7 +139,7 @@ def setup_appengine(session): def run_tests_in_sesssion( session, interpreter, sample_directories, use_appengine=True, - skip_flaky=False, changed_only=False): + skip_flaky=False): """This is the main function for executing tests. It: @@ -144,13 +147,6 @@ def run_tests_in_sesssion( 2. Installs the test requirements. 3. Determines which pytest arguments to use. skip_flaky causes extra arguments to be passed that will skip tests marked flaky. - 4. If posargs are specified, it will use that as the list of samples to - test. - 5. If posargs is not specified, it will gather the list of samples by - walking the repository tree. - 6. If changed_only was specified, it'll use Travis environment variables - to figure out which samples should be tested based on which files - were changed. 7. For each sample directory, it runs py.test. """ session.interpreter = interpreter @@ -165,13 +161,6 @@ def run_tests_in_sesssion( if skip_flaky: pytest_args.append('-m not slow and not flaky') - if changed_only: - changed_files = get_changed_files() - sample_directories = filter_samples( - sample_directories, changed_files) - print('Running tests on a subset of samples: ') - print('\n'.join(sample_directories)) - for sample in sample_directories: # Ignore lib and env directories ignore_args = [ @@ -211,28 +200,62 @@ def session_gae(session): def session_travis(session, subsession): """On travis, just run with python3.4 and don't run slow or flaky tests.""" if subsession == 'tests': + interpreter = 'python3.4' sample_directories = collect_sample_dirs( '.', set('./appengine/standard')) - run_tests_in_sesssion( - session, 'python3.4', sample_directories, - skip_flaky=True, changed_only=True) - else: + elif subsession == 'gae': + interpreter = 'python2.7' sample_directories = collect_sample_dirs('appengine/standard') - run_tests_in_sesssion( - session, 'python2.7', sample_directories, - skip_flaky=True, changed_only=True) + + changed_files = get_changed_files() + sample_directories = filter_samples( + sample_directories, changed_files) + + if not sample_directories: + print('No samples changed.') + return + + print('Running tests on a subset of samples: ') + print('\n'.join(sample_directories)) + + run_tests_in_sesssion( + session, interpreter, sample_directories, + skip_flaky=True, changed_only=True) def session_lint(session): """Lints each sample.""" + sample_directories = session.posargs + if not sample_directories: + sample_directories = collect_sample_dirs('.') + + # On travis, on lint changed samples. + if ON_TRAVIS: + changed_files = get_changed_files() + sample_directories = filter_samples( + sample_directories, changed_files) + session.install('flake8', 'flake8-import-order') - session.run( - 'flake8', '--builtin=gettext', '--max-complexity=15', - '--import-order-style=google', - '--exclude', - 'container_engine/django_tutorial/polls/migrations/*,.nox,.cache,env,' - 'lib', - *(session.posargs or ['.'])) + + for sample_directory in sample_directories: + # Determine local import names + local_names = [ + basename + for basename, extension + in [os.path.splitext(path) for path + in os.listdir(sample_directory)] + if extension == '.py' or os.path.isdir( + os.path.join(sample_directory, basename))] + + session.run( + 'flake8', + '--show-source', + '--builtin', 'gettext', + '--max-complexity', '15', + '--import-order-style', 'google', + '--exclude', '.nox,.cache,env,lib', + '--application-import-names', ','.join(local_names), + sample_directory) def session_reqcheck(session): From 08f268033fa89ba2f7cbe60a42532d2ca2617378 Mon Sep 17 00:00:00 2001 From: Jon Wayne Parrott Date: Fri, 19 Aug 2016 13:56:28 -0700 Subject: [PATCH 2/4] Fix import order lint errors Change-Id: Ieaf7237fc6f925daec46a07d2e81a452b841198a --- appengine/flexible/endpoints/main_test.py | 3 ++- appengine/flexible/extending_runtime/main_test.py | 3 ++- appengine/flexible/extending_runtime_compat/main_test.py | 3 ++- appengine/flexible/memcache/main_test.py | 3 ++- appengine/flexible/pubsub/main_test.py | 3 ++- appengine/flexible/redis/main_test.py | 3 ++- appengine/flexible/storage/main_test.py | 3 ++- appengine/standard/__init__.py | 0 appengine/standard/app_identity/asserting/main_test.py | 3 ++- appengine/standard/app_identity/incoming/main_test.py | 3 ++- appengine/standard/app_identity/signing/main_test.py | 3 ++- appengine/standard/appstats/main_test.py | 3 ++- appengine/standard/background/main_test.py | 4 ++-- appengine/standard/bigquery/main_test.py | 3 ++- appengine/standard/blobstore/main_test.py | 3 ++- appengine/standard/cloudsql/main_test.py | 3 ++- appengine/standard/endpoints-frameworks-v2/echo/main_test.py | 3 ++- .../standard/endpoints-frameworks-v2/quickstart/main_test.py | 3 ++- appengine/standard/endpoints/backend/main_test.py | 3 ++- appengine/standard/hello_world/main_test.py | 3 ++- appengine/standard/images/api/blobstore_test.py | 3 ++- appengine/standard/images/api/main_test.py | 3 ++- appengine/standard/images/guestbook/main_test.py | 3 ++- appengine/standard/logging/reading_logs/main_test.py | 3 ++- appengine/standard/logging/writing_logs/main_test.py | 3 ++- appengine/standard/mail/attachment_test.py | 3 ++- appengine/standard/mail/header_test.py | 3 ++- appengine/standard/mail/send_mail_test.py | 3 ++- appengine/standard/mail/send_message_test.py | 3 ++- appengine/standard/mail/user_signup_test.py | 3 ++- appengine/standard/mailgun/main_test.py | 3 ++- .../standard/memcache/best_practices/batch/batch_test.py | 4 ++-- .../standard/memcache/best_practices/failure/failure_test.py | 4 ++-- .../best_practices/migration_step1/migration1_test.py | 4 ++-- .../best_practices/migration_step2/migration2_test.py | 4 ++-- .../standard/memcache/best_practices/sharing/sharing_test.py | 4 ++-- appengine/standard/memcache/guestbook/main_test.py | 2 +- appengine/standard/memcache/snippets/snippets_test.py | 2 ++ appengine/standard/modules/backend_test.py | 4 ++-- appengine/standard/modules/main_test.py | 4 ++-- appengine/standard/multitenancy/datastore_test.py | 3 ++- appengine/standard/multitenancy/memcache_test.py | 3 ++- appengine/standard/multitenancy/taskqueue_test.py | 3 ++- appengine/standard/ndb/async/app_async_test.py | 3 ++- appengine/standard/ndb/async/app_sync_test.py | 3 ++- .../standard/ndb/async/app_toplevel/app_toplevel_test.py | 3 ++- appengine/standard/ndb/async/guestbook_test.py | 3 ++- appengine/standard/ndb/async/shopping_cart_test.py | 1 + appengine/standard/ndb/cache/snippets_test.py | 1 + appengine/standard/ndb/entities/snippets_test.py | 1 + .../standard/ndb/modeling/contact_with_group_models_test.py | 3 ++- appengine/standard/ndb/modeling/keyproperty_models_test.py | 3 ++- appengine/standard/ndb/modeling/parent_child_models_test.py | 3 ++- .../standard/ndb/modeling/relation_model_models_test.py | 1 + appengine/standard/ndb/overview/main_test.py | 3 ++- appengine/standard/ndb/property_subclasses/snippets_test.py | 3 ++- appengine/standard/ndb/queries/guestbook_test.py | 3 ++- appengine/standard/ndb/queries/snippets_test.py | 1 + appengine/standard/ndb/transactions/main_test.py | 3 ++- appengine/standard/requests/main_test.py | 3 ++- appengine/standard/search/snippets/snippets_test.py | 1 + appengine/standard/sendgrid/main_test.py | 3 ++- appengine/standard/storage/main_test.py | 4 +++- appengine/standard/taskqueue/counter/application_test.py | 3 ++- .../standard/taskqueue/pull-counter/pullcounter_test.py | 3 ++- appengine/standard/urlfetch/async/rpc_test.py | 3 ++- appengine/standard/urlfetch/snippets/main_test.py | 4 ++-- appengine/standard/users/main_test.py | 3 ++- appengine/standard/xmpp/xmpp_test.py | 1 + bigquery/api/export_data_to_cloud_storage_test.py | 3 ++- bigquery/api/installed_app_test.py | 3 ++- bigquery/api/load_data_by_post_test.py | 1 + bigquery/api/load_data_from_csv_test.py | 1 + .../blog_test.py | 3 ++- compute/api/create_instance_test.py | 3 ++- compute/auth/access_token_test.py | 3 ++- compute/autoscaler/demo/frontend_test.py | 3 ++- compute/encryption/generate_wrapped_rsa_key_test.py | 3 ++- compute/metadata/main_test.py | 3 ++- dataproc/dataproc_e2e_test.py | 3 ++- datastore/api/snippets_test.py | 1 + datastore/api/tasks_test.py | 1 + dns/api/main_test.py | 3 ++- error_reporting/main_test.py | 3 ++- language/movie_nl/main_test.py | 3 ++- logging/cloud-client/export_test.py | 3 ++- logging/cloud-client/snippets_test.py | 1 + monitoring/api/v3/custom_metric_test.py | 5 +++-- monitoring/api/v3/list_resources_test.py | 1 + speech/api/speech_async_grpc_test.py | 1 + speech/api/speech_grpc_test.py | 1 + storage/api/customer_supplied_keys_test.py | 3 ++- storage/cloud-client/encryption_test.py | 3 ++- storage/cloud-client/snippets_test.py | 1 + vision/api/face_detection/faces_test.py | 3 ++- 95 files changed, 173 insertions(+), 87 deletions(-) delete mode 100644 appengine/standard/__init__.py diff --git a/appengine/flexible/endpoints/main_test.py b/appengine/flexible/endpoints/main_test.py index 59b3f8ba365..2b9b4b66c42 100644 --- a/appengine/flexible/endpoints/main_test.py +++ b/appengine/flexible/endpoints/main_test.py @@ -16,9 +16,10 @@ import json import os -import main import pytest +import main + @pytest.fixture def client(monkeypatch): diff --git a/appengine/flexible/extending_runtime/main_test.py b/appengine/flexible/extending_runtime/main_test.py index 44fb434a498..7c6fe2e1f10 100644 --- a/appengine/flexible/extending_runtime/main_test.py +++ b/appengine/flexible/extending_runtime/main_test.py @@ -14,9 +14,10 @@ import os -import main import pytest +import main + @pytest.mark.skipif( not os.path.exists('/usr/games/fortune'), diff --git a/appengine/flexible/extending_runtime_compat/main_test.py b/appengine/flexible/extending_runtime_compat/main_test.py index 43e9a2be3e1..0a62c87a733 100644 --- a/appengine/flexible/extending_runtime_compat/main_test.py +++ b/appengine/flexible/extending_runtime_compat/main_test.py @@ -14,9 +14,10 @@ import os -import main import pytest +import main + @pytest.mark.skipif( not os.path.exists('/usr/games/fortune'), diff --git a/appengine/flexible/memcache/main_test.py b/appengine/flexible/memcache/main_test.py index 175a863172b..d8a0a1efff2 100644 --- a/appengine/flexible/memcache/main_test.py +++ b/appengine/flexible/memcache/main_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import pytest +import main + def test_index(): try: diff --git a/appengine/flexible/pubsub/main_test.py b/appengine/flexible/pubsub/main_test.py index 3d4b7336d40..c2911415275 100644 --- a/appengine/flexible/pubsub/main_test.py +++ b/appengine/flexible/pubsub/main_test.py @@ -16,9 +16,10 @@ import json import os -import main import pytest +import main + @pytest.fixture def client(): diff --git a/appengine/flexible/redis/main_test.py b/appengine/flexible/redis/main_test.py index fb4562d6cac..f314c04487a 100644 --- a/appengine/flexible/redis/main_test.py +++ b/appengine/flexible/redis/main_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import pytest +import main + def test_index(): try: diff --git a/appengine/flexible/storage/main_test.py b/appengine/flexible/storage/main_test.py index 88f710e824b..76391d74f64 100644 --- a/appengine/flexible/storage/main_test.py +++ b/appengine/flexible/storage/main_test.py @@ -12,11 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import pytest import requests from six import BytesIO +import main + @pytest.fixture def client(): diff --git a/appengine/standard/__init__.py b/appengine/standard/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/appengine/standard/app_identity/asserting/main_test.py b/appengine/standard/app_identity/asserting/main_test.py index 33c03a75ecd..66169aa2b82 100644 --- a/appengine/standard/app_identity/asserting/main_test.py +++ b/appengine/standard/app_identity/asserting/main_test.py @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import mock import webtest +import main + def test_app(testbed): app = webtest.TestApp(main.app) diff --git a/appengine/standard/app_identity/incoming/main_test.py b/appengine/standard/app_identity/incoming/main_test.py index 0365a52327d..38faaa3f015 100644 --- a/appengine/standard/app_identity/incoming/main_test.py +++ b/appengine/standard/app_identity/incoming/main_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import webtest +import main + def test_app(testbed): app = webtest.TestApp(main.app) diff --git a/appengine/standard/app_identity/signing/main_test.py b/appengine/standard/app_identity/signing/main_test.py index 2c2fdbc7bc8..4864f9a18db 100644 --- a/appengine/standard/app_identity/signing/main_test.py +++ b/appengine/standard/app_identity/signing/main_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import webtest +import main + def test_app(testbed): app = webtest.TestApp(main.app) diff --git a/appengine/standard/appstats/main_test.py b/appengine/standard/appstats/main_test.py index 6909d802cf6..9cceda3d317 100644 --- a/appengine/standard/appstats/main_test.py +++ b/appengine/standard/appstats/main_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import webtest +import main + def test_app(testbed): app = webtest.TestApp(main.app) diff --git a/appengine/standard/background/main_test.py b/appengine/standard/background/main_test.py index 55cf5bfe47f..139f528adde 100644 --- a/appengine/standard/background/main_test.py +++ b/appengine/standard/background/main_test.py @@ -12,12 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main - from mock import patch import pytest import webtest +import main + @pytest.fixture def app(cloud_config, testbed): diff --git a/appengine/standard/bigquery/main_test.py b/appengine/standard/bigquery/main_test.py index 77e192b2dac..470eddf13d2 100644 --- a/appengine/standard/bigquery/main_test.py +++ b/appengine/standard/bigquery/main_test.py @@ -15,11 +15,12 @@ import re from googleapiclient.http import HttpMock -import main import mock import pytest import webtest +import main + @pytest.fixture def app(cloud_config, testbed): diff --git a/appengine/standard/blobstore/main_test.py b/appengine/standard/blobstore/main_test.py index 2b62074dae4..adfc579698e 100644 --- a/appengine/standard/blobstore/main_test.py +++ b/appengine/standard/blobstore/main_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import webtest +import main + def test_app(testbed, login): app = webtest.TestApp(main.app) diff --git a/appengine/standard/cloudsql/main_test.py b/appengine/standard/cloudsql/main_test.py index f2debea7a96..b08fddac57a 100644 --- a/appengine/standard/cloudsql/main_test.py +++ b/appengine/standard/cloudsql/main_test.py @@ -15,10 +15,11 @@ import os import re -import main import pytest import webtest +import main + @pytest.mark.skipif( not os.path.exists('/var/run/mysqld/mysqld.sock'), diff --git a/appengine/standard/endpoints-frameworks-v2/echo/main_test.py b/appengine/standard/endpoints-frameworks-v2/echo/main_test.py index 55a5b836a32..487a68db514 100644 --- a/appengine/standard/endpoints-frameworks-v2/echo/main_test.py +++ b/appengine/standard/endpoints-frameworks-v2/echo/main_test.py @@ -13,11 +13,12 @@ # limitations under the License. import endpoints -import main import mock from protorpc import message_types import pytest +import main + def test_echo(): api = main.EchoApi() diff --git a/appengine/standard/endpoints-frameworks-v2/quickstart/main_test.py b/appengine/standard/endpoints-frameworks-v2/quickstart/main_test.py index 56fefa2ead6..c8255a90d30 100644 --- a/appengine/standard/endpoints-frameworks-v2/quickstart/main_test.py +++ b/appengine/standard/endpoints-frameworks-v2/quickstart/main_test.py @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import mock from protorpc import message_types +import main + def test_list_greetings(testbed): api = main.GreetingApi() diff --git a/appengine/standard/endpoints/backend/main_test.py b/appengine/standard/endpoints/backend/main_test.py index 56fefa2ead6..c8255a90d30 100644 --- a/appengine/standard/endpoints/backend/main_test.py +++ b/appengine/standard/endpoints/backend/main_test.py @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import mock from protorpc import message_types +import main + def test_list_greetings(testbed): api = main.GreetingApi() diff --git a/appengine/standard/hello_world/main_test.py b/appengine/standard/hello_world/main_test.py index 1f058098db3..64670c5981d 100644 --- a/appengine/standard/hello_world/main_test.py +++ b/appengine/standard/hello_world/main_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import webtest +import main + def test_get(): app = webtest.TestApp(main.app) diff --git a/appengine/standard/images/api/blobstore_test.py b/appengine/standard/images/api/blobstore_test.py index a0f5e0d4129..d6b3f4e698f 100644 --- a/appengine/standard/images/api/blobstore_test.py +++ b/appengine/standard/images/api/blobstore_test.py @@ -12,11 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import blobstore import mock import pytest import webtest +import blobstore + @pytest.fixture def app(testbed): diff --git a/appengine/standard/images/api/main_test.py b/appengine/standard/images/api/main_test.py index 2cad660af47..33caf1fa2f0 100644 --- a/appengine/standard/images/api/main_test.py +++ b/appengine/standard/images/api/main_test.py @@ -12,11 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import mock import pytest import webtest +import main + @pytest.fixture def app(testbed): diff --git a/appengine/standard/images/guestbook/main_test.py b/appengine/standard/images/guestbook/main_test.py index f3315973587..8ef5dfc7339 100644 --- a/appengine/standard/images/guestbook/main_test.py +++ b/appengine/standard/images/guestbook/main_test.py @@ -12,11 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import mock import pytest import webtest +import main + @pytest.fixture def app(testbed): diff --git a/appengine/standard/logging/reading_logs/main_test.py b/appengine/standard/logging/reading_logs/main_test.py index 439243f7b35..03476add6ec 100644 --- a/appengine/standard/logging/reading_logs/main_test.py +++ b/appengine/standard/logging/reading_logs/main_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import webtest +import main + def test_app(testbed): app = webtest.TestApp(main.app) diff --git a/appengine/standard/logging/writing_logs/main_test.py b/appengine/standard/logging/writing_logs/main_test.py index 3f0f38b1ee8..181f788d33a 100644 --- a/appengine/standard/logging/writing_logs/main_test.py +++ b/appengine/standard/logging/writing_logs/main_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import webtest +import main + def test_app(testbed): app = webtest.TestApp(main.app) diff --git a/appengine/standard/mail/attachment_test.py b/appengine/standard/mail/attachment_test.py index d94415b1205..d808a2cbc34 100644 --- a/appengine/standard/mail/attachment_test.py +++ b/appengine/standard/mail/attachment_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import attachment import webtest +import attachment + def test_send_mail(testbed): testbed.init_mail_stub() diff --git a/appengine/standard/mail/header_test.py b/appengine/standard/mail/header_test.py index 4935c5999f1..da514ef0e72 100644 --- a/appengine/standard/mail/header_test.py +++ b/appengine/standard/mail/header_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import header import webtest +import header + def test_send_mail(testbed): testbed.init_mail_stub() diff --git a/appengine/standard/mail/send_mail_test.py b/appengine/standard/mail/send_mail_test.py index f068ed64617..5e5f7e6be02 100644 --- a/appengine/standard/mail/send_mail_test.py +++ b/appengine/standard/mail/send_mail_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import send_mail import webtest +import send_mail + def test_send_mail(testbed): testbed.init_mail_stub() diff --git a/appengine/standard/mail/send_message_test.py b/appengine/standard/mail/send_message_test.py index 640dc6efbb3..d56f58e0d6f 100644 --- a/appengine/standard/mail/send_message_test.py +++ b/appengine/standard/mail/send_message_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import send_message import webtest +import send_message + def test_send_message(testbed): testbed.init_mail_stub() diff --git a/appengine/standard/mail/user_signup_test.py b/appengine/standard/mail/user_signup_test.py index d855ce7e140..c386f2ace15 100644 --- a/appengine/standard/mail/user_signup_test.py +++ b/appengine/standard/mail/user_signup_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import user_signup import webtest +import user_signup + def test_user_signup(testbed): testbed.init_mail_stub() diff --git a/appengine/standard/mailgun/main_test.py b/appengine/standard/mailgun/main_test.py index de92f476f29..91980afe867 100644 --- a/appengine/standard/mailgun/main_test.py +++ b/appengine/standard/mailgun/main_test.py @@ -14,11 +14,12 @@ from googleapiclient.http import HttpMockSequence import httplib2 -import main import mock import pytest import webtest +import main + class HttpMockSequenceWithCredentials(HttpMockSequence): def add_credentials(self, *args): diff --git a/appengine/standard/memcache/best_practices/batch/batch_test.py b/appengine/standard/memcache/best_practices/batch/batch_test.py index 74363741fc1..ca0883f362e 100644 --- a/appengine/standard/memcache/best_practices/batch/batch_test.py +++ b/appengine/standard/memcache/best_practices/batch/batch_test.py @@ -12,11 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import batch - import pytest import webtest +import batch + @pytest.fixture def app(testbed): diff --git a/appengine/standard/memcache/best_practices/failure/failure_test.py b/appengine/standard/memcache/best_practices/failure/failure_test.py index d1f034db123..125054be64c 100644 --- a/appengine/standard/memcache/best_practices/failure/failure_test.py +++ b/appengine/standard/memcache/best_practices/failure/failure_test.py @@ -12,11 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import failure - import pytest import webtest +import failure + @pytest.fixture def app(testbed): diff --git a/appengine/standard/memcache/best_practices/migration_step1/migration1_test.py b/appengine/standard/memcache/best_practices/migration_step1/migration1_test.py index 794188b8aa1..fe1b4b7acc8 100644 --- a/appengine/standard/memcache/best_practices/migration_step1/migration1_test.py +++ b/appengine/standard/memcache/best_practices/migration_step1/migration1_test.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import migration1 - import webtest +import migration1 + def test_get(testbed): app = webtest.TestApp(migration1.app) diff --git a/appengine/standard/memcache/best_practices/migration_step2/migration2_test.py b/appengine/standard/memcache/best_practices/migration_step2/migration2_test.py index be70621692b..b2441c4331f 100644 --- a/appengine/standard/memcache/best_practices/migration_step2/migration2_test.py +++ b/appengine/standard/memcache/best_practices/migration_step2/migration2_test.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import migration2 - import webtest +import migration2 + def test_get(testbed): app = webtest.TestApp(migration2.app) diff --git a/appengine/standard/memcache/best_practices/sharing/sharing_test.py b/appengine/standard/memcache/best_practices/sharing/sharing_test.py index c23ee61f2d9..f1cb8d0a1d6 100644 --- a/appengine/standard/memcache/best_practices/sharing/sharing_test.py +++ b/appengine/standard/memcache/best_practices/sharing/sharing_test.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import sharing - import webtest +import sharing + def test_get(testbed): app = webtest.TestApp(sharing.app) diff --git a/appengine/standard/memcache/guestbook/main_test.py b/appengine/standard/memcache/guestbook/main_test.py index 977004c1abe..1851b78db88 100644 --- a/appengine/standard/memcache/guestbook/main_test.py +++ b/appengine/standard/memcache/guestbook/main_test.py @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +import webtest import main -import webtest def test_app(testbed): diff --git a/appengine/standard/memcache/snippets/snippets_test.py b/appengine/standard/memcache/snippets/snippets_test.py index fae6ae872a6..8d34d8f408b 100644 --- a/appengine/standard/memcache/snippets/snippets_test.py +++ b/appengine/standard/memcache/snippets/snippets_test.py @@ -14,8 +14,10 @@ from google.appengine.api import memcache from mock import patch + import snippets + SNIPPET_VALUES = { "weather_USA_98105": "raining", "weather_USA_98115": "cloudy", diff --git a/appengine/standard/modules/backend_test.py b/appengine/standard/modules/backend_test.py index 5d82f5a8298..e4022c95586 100644 --- a/appengine/standard/modules/backend_test.py +++ b/appengine/standard/modules/backend_test.py @@ -12,11 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import backend - import pytest import webtest +import backend + @pytest.fixture def app(): diff --git a/appengine/standard/modules/main_test.py b/appengine/standard/modules/main_test.py index 97f0a6f029e..6ea602d425b 100644 --- a/appengine/standard/modules/main_test.py +++ b/appengine/standard/modules/main_test.py @@ -12,12 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main - import mock import pytest import webtest +import main + @pytest.fixture def app(): diff --git a/appengine/standard/multitenancy/datastore_test.py b/appengine/standard/multitenancy/datastore_test.py index 3c3dcc2f284..ff23e9b301f 100644 --- a/appengine/standard/multitenancy/datastore_test.py +++ b/appengine/standard/multitenancy/datastore_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import datastore import webtest +import datastore + def test_datastore(testbed): app = webtest.TestApp(datastore.app) diff --git a/appengine/standard/multitenancy/memcache_test.py b/appengine/standard/multitenancy/memcache_test.py index 97bc7504e17..27410ad2b4d 100644 --- a/appengine/standard/multitenancy/memcache_test.py +++ b/appengine/standard/multitenancy/memcache_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import memcache import webtest +import memcache + def test_memcache(testbed): app = webtest.TestApp(memcache.app) diff --git a/appengine/standard/multitenancy/taskqueue_test.py b/appengine/standard/multitenancy/taskqueue_test.py index c0f658bc2ac..636478a41b0 100644 --- a/appengine/standard/multitenancy/taskqueue_test.py +++ b/appengine/standard/multitenancy/taskqueue_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import taskqueue import webtest +import taskqueue + def test_taskqueue(testbed, run_tasks): app = webtest.TestApp(taskqueue.app) diff --git a/appengine/standard/ndb/async/app_async_test.py b/appengine/standard/ndb/async/app_async_test.py index ba0af15c3ed..57c84c18571 100644 --- a/appengine/standard/ndb/async/app_async_test.py +++ b/appengine/standard/ndb/async/app_async_test.py @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import app_async import pytest import webtest +import app_async + @pytest.fixture def app(testbed): diff --git a/appengine/standard/ndb/async/app_sync_test.py b/appengine/standard/ndb/async/app_sync_test.py index 3f42385f40c..27ed85b68d9 100644 --- a/appengine/standard/ndb/async/app_sync_test.py +++ b/appengine/standard/ndb/async/app_sync_test.py @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import app_sync import pytest import webtest +import app_sync + @pytest.fixture def app(testbed): diff --git a/appengine/standard/ndb/async/app_toplevel/app_toplevel_test.py b/appengine/standard/ndb/async/app_toplevel/app_toplevel_test.py index 4833d316296..967a1474451 100644 --- a/appengine/standard/ndb/async/app_toplevel/app_toplevel_test.py +++ b/appengine/standard/ndb/async/app_toplevel/app_toplevel_test.py @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import app_toplevel import pytest import webtest +import app_toplevel + @pytest.fixture def app(testbed): diff --git a/appengine/standard/ndb/async/guestbook_test.py b/appengine/standard/ndb/async/guestbook_test.py index 418c12d35c6..e1c51a71476 100644 --- a/appengine/standard/ndb/async/guestbook_test.py +++ b/appengine/standard/ndb/async/guestbook_test.py @@ -12,10 +12,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import guestbook import pytest import webtest +import guestbook + @pytest.fixture def app(testbed): diff --git a/appengine/standard/ndb/async/shopping_cart_test.py b/appengine/standard/ndb/async/shopping_cart_test.py index 7cfacfed4da..78f519baba6 100644 --- a/appengine/standard/ndb/async/shopping_cart_test.py +++ b/appengine/standard/ndb/async/shopping_cart_test.py @@ -14,6 +14,7 @@ from google.appengine.ext import ndb import pytest + import shopping_cart diff --git a/appengine/standard/ndb/cache/snippets_test.py b/appengine/standard/ndb/cache/snippets_test.py index ec117568daa..257525895ee 100644 --- a/appengine/standard/ndb/cache/snippets_test.py +++ b/appengine/standard/ndb/cache/snippets_test.py @@ -13,6 +13,7 @@ # limitations under the License. from google.appengine.ext import ndb + import snippets diff --git a/appengine/standard/ndb/entities/snippets_test.py b/appengine/standard/ndb/entities/snippets_test.py index b779ad96a05..e93ffc6b81a 100644 --- a/appengine/standard/ndb/entities/snippets_test.py +++ b/appengine/standard/ndb/entities/snippets_test.py @@ -16,6 +16,7 @@ from google.appengine.ext import ndb from google.appengine.ext.ndb.google_imports import datastore_errors import pytest + import snippets diff --git a/appengine/standard/ndb/modeling/contact_with_group_models_test.py b/appengine/standard/ndb/modeling/contact_with_group_models_test.py index 0ec40949d1c..1afe71682df 100644 --- a/appengine/standard/ndb/modeling/contact_with_group_models_test.py +++ b/appengine/standard/ndb/modeling/contact_with_group_models_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import contact_with_group_models as models from google.appengine.ext import ndb +import contact_with_group_models as models + def test_models(testbed): # Creates 3 contacts and 1 group. diff --git a/appengine/standard/ndb/modeling/keyproperty_models_test.py b/appengine/standard/ndb/modeling/keyproperty_models_test.py index 66c983ac4d5..a2a4d5a3bd9 100644 --- a/appengine/standard/ndb/modeling/keyproperty_models_test.py +++ b/appengine/standard/ndb/modeling/keyproperty_models_test.py @@ -14,9 +14,10 @@ """Test classes for code snippet for modeling article.""" -import keyproperty_models as models import pytest +import keyproperty_models as models + def test_models(testbed): name = 'Takashi Matsuo' diff --git a/appengine/standard/ndb/modeling/parent_child_models_test.py b/appengine/standard/ndb/modeling/parent_child_models_test.py index cae2c6bedc7..49afc670c57 100644 --- a/appengine/standard/ndb/modeling/parent_child_models_test.py +++ b/appengine/standard/ndb/modeling/parent_child_models_test.py @@ -15,9 +15,10 @@ """Test classes for code snippet for modeling article.""" from google.appengine.ext import ndb -import parent_child_models as models import pytest +import parent_child_models as models + NAME = 'Takashi Matsuo' diff --git a/appengine/standard/ndb/modeling/relation_model_models_test.py b/appengine/standard/ndb/modeling/relation_model_models_test.py index 14d4359a298..8310132d133 100644 --- a/appengine/standard/ndb/modeling/relation_model_models_test.py +++ b/appengine/standard/ndb/modeling/relation_model_models_test.py @@ -15,6 +15,7 @@ """Test classes for code snippet for modeling article.""" from google.appengine.ext import ndb + import relation_model_models as models diff --git a/appengine/standard/ndb/overview/main_test.py b/appengine/standard/ndb/overview/main_test.py index 6abe11e8d42..1851b78db88 100644 --- a/appengine/standard/ndb/overview/main_test.py +++ b/appengine/standard/ndb/overview/main_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import webtest +import main + def test_app(testbed): app = webtest.TestApp(main.app) diff --git a/appengine/standard/ndb/property_subclasses/snippets_test.py b/appengine/standard/ndb/property_subclasses/snippets_test.py index 0ef4b63fcec..8aa621620fa 100644 --- a/appengine/standard/ndb/property_subclasses/snippets_test.py +++ b/appengine/standard/ndb/property_subclasses/snippets_test.py @@ -15,8 +15,9 @@ import datetime from google.appengine.ext import ndb -import my_models import pytest + +import my_models import snippets diff --git a/appengine/standard/ndb/queries/guestbook_test.py b/appengine/standard/ndb/queries/guestbook_test.py index d9da413a8d5..9ddfcd26902 100644 --- a/appengine/standard/ndb/queries/guestbook_test.py +++ b/appengine/standard/ndb/queries/guestbook_test.py @@ -15,10 +15,11 @@ import re from google.appengine.ext import ndb -import guestbook import pytest import webtest +import guestbook + @pytest.fixture def app(testbed): diff --git a/appengine/standard/ndb/queries/snippets_test.py b/appengine/standard/ndb/queries/snippets_test.py index c53d48cde3b..d8e6ddef79c 100644 --- a/appengine/standard/ndb/queries/snippets_test.py +++ b/appengine/standard/ndb/queries/snippets_test.py @@ -13,6 +13,7 @@ # limitations under the License. from guestbook import Greeting + import snippets from snippets_models import (Account, Address, Article, Bar, Contact, FlexEmployee, Message) diff --git a/appengine/standard/ndb/transactions/main_test.py b/appengine/standard/ndb/transactions/main_test.py index 43c6349bbbe..cd19af5bffc 100644 --- a/appengine/standard/ndb/transactions/main_test.py +++ b/appengine/standard/ndb/transactions/main_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import pytest +import main + @pytest.fixture def app(testbed): diff --git a/appengine/standard/requests/main_test.py b/appengine/standard/requests/main_test.py index ffed54a69e2..c978856824f 100644 --- a/appengine/standard/requests/main_test.py +++ b/appengine/standard/requests/main_test.py @@ -15,10 +15,11 @@ import os from google.appengine.runtime import DeadlineExceededError -import main import mock import webtest +import main + def test_timer(testbed): app = webtest.TestApp(main.app) diff --git a/appengine/standard/search/snippets/snippets_test.py b/appengine/standard/search/snippets/snippets_test.py index e4e00211880..3d22bbb5561 100644 --- a/appengine/standard/search/snippets/snippets_test.py +++ b/appengine/standard/search/snippets/snippets_test.py @@ -15,6 +15,7 @@ from google.appengine.api import search import pytest + import snippets diff --git a/appengine/standard/sendgrid/main_test.py b/appengine/standard/sendgrid/main_test.py index 918493fc8e1..72c128fd71a 100644 --- a/appengine/standard/sendgrid/main_test.py +++ b/appengine/standard/sendgrid/main_test.py @@ -12,11 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import mock import pytest import webtest +import main + @pytest.fixture def app(): diff --git a/appengine/standard/storage/main_test.py b/appengine/standard/storage/main_test.py index e68fe66a16d..7bb5c8c595b 100644 --- a/appengine/standard/storage/main_test.py +++ b/appengine/standard/storage/main_test.py @@ -11,11 +11,13 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + import re -import main import webtest +import main + def test_get(cloud_config): main.BUCKET_NAME = cloud_config.project diff --git a/appengine/standard/taskqueue/counter/application_test.py b/appengine/standard/taskqueue/counter/application_test.py index 7303e7da30c..09a19abbd72 100644 --- a/appengine/standard/taskqueue/counter/application_test.py +++ b/appengine/standard/taskqueue/counter/application_test.py @@ -12,8 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import application import webtest + +import application import worker diff --git a/appengine/standard/taskqueue/pull-counter/pullcounter_test.py b/appengine/standard/taskqueue/pull-counter/pullcounter_test.py index 15991cf6404..6bda3e2f40e 100644 --- a/appengine/standard/taskqueue/pull-counter/pullcounter_test.py +++ b/appengine/standard/taskqueue/pull-counter/pullcounter_test.py @@ -15,10 +15,11 @@ import os from google.appengine.ext import testbed as gaetestbed -import main import mock import webtest +import main + def test_app(testbed): key_name = 'foo' diff --git a/appengine/standard/urlfetch/async/rpc_test.py b/appengine/standard/urlfetch/async/rpc_test.py index cff5c985f78..ed729a969b4 100644 --- a/appengine/standard/urlfetch/async/rpc_test.py +++ b/appengine/standard/urlfetch/async/rpc_test.py @@ -16,9 +16,10 @@ from google.appengine.api import urlfetch import mock import pytest -import rpc import webtest +import rpc + @pytest.fixture def app(): diff --git a/appengine/standard/urlfetch/snippets/main_test.py b/appengine/standard/urlfetch/snippets/main_test.py index aa84d48649d..4ffdf21dfac 100644 --- a/appengine/standard/urlfetch/snippets/main_test.py +++ b/appengine/standard/urlfetch/snippets/main_test.py @@ -12,12 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main - import mock import pytest import webtest +import main + @pytest.fixture def app(testbed): diff --git a/appengine/standard/users/main_test.py b/appengine/standard/users/main_test.py index d695faa4e7f..e6cb557f35f 100644 --- a/appengine/standard/users/main_test.py +++ b/appengine/standard/users/main_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import webtest +import main + def test_index(testbed, login): app = webtest.TestApp(main.app) diff --git a/appengine/standard/xmpp/xmpp_test.py b/appengine/standard/xmpp/xmpp_test.py index ed670505778..ddbd8bacd00 100644 --- a/appengine/standard/xmpp/xmpp_test.py +++ b/appengine/standard/xmpp/xmpp_test.py @@ -15,6 +15,7 @@ import mock import pytest import webtest + import xmpp diff --git a/bigquery/api/export_data_to_cloud_storage_test.py b/bigquery/api/export_data_to_cloud_storage_test.py index 72a41069199..33636fc9e30 100644 --- a/bigquery/api/export_data_to_cloud_storage_test.py +++ b/bigquery/api/export_data_to_cloud_storage_test.py @@ -11,9 +11,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from export_data_to_cloud_storage import main from gcp.testing.flaky import flaky +from export_data_to_cloud_storage import main + DATASET_ID = 'test_dataset' TABLE_ID = 'test_table' diff --git a/bigquery/api/installed_app_test.py b/bigquery/api/installed_app_test.py index e8265f4a400..d52c1e3e883 100644 --- a/bigquery/api/installed_app_test.py +++ b/bigquery/api/installed_app_test.py @@ -13,9 +13,10 @@ import re -import installed_app from oauth2client.client import GoogleCredentials +import installed_app + class Namespace(object): def __init__(self, **kwargs): diff --git a/bigquery/api/load_data_by_post_test.py b/bigquery/api/load_data_by_post_test.py index ca4d1ea38e9..544adb94ade 100644 --- a/bigquery/api/load_data_by_post_test.py +++ b/bigquery/api/load_data_by_post_test.py @@ -14,6 +14,7 @@ import re from gcp.testing.flaky import flaky + from load_data_by_post import load_data DATASET_ID = 'ephemeral_test_dataset' diff --git a/bigquery/api/load_data_from_csv_test.py b/bigquery/api/load_data_from_csv_test.py index 6e7fc4323db..988af935ac3 100644 --- a/bigquery/api/load_data_from_csv_test.py +++ b/bigquery/api/load_data_from_csv_test.py @@ -12,6 +12,7 @@ # limitations under the License. from gcp.testing.flaky import flaky + from load_data_from_csv import main DATASET_ID = 'test_dataset' diff --git a/blog/introduction_to_data_models_in_cloud_datastore/blog_test.py b/blog/introduction_to_data_models_in_cloud_datastore/blog_test.py index 16f41c883ec..04eb0c4a8fe 100644 --- a/blog/introduction_to_data_models_in_cloud_datastore/blog_test.py +++ b/blog/introduction_to_data_models_in_cloud_datastore/blog_test.py @@ -11,9 +11,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -from blog import main from gcp.testing.flaky import flaky +from blog import main + @flaky def test_main(cloud_config): diff --git a/compute/api/create_instance_test.py b/compute/api/create_instance_test.py index f85dcf09d0e..b458b46387f 100644 --- a/compute/api/create_instance_test.py +++ b/compute/api/create_instance_test.py @@ -13,9 +13,10 @@ import re -from create_instance import main from gcp.testing.flaky import flaky +from create_instance import main + @flaky def test_main(cloud_config, capsys): diff --git a/compute/auth/access_token_test.py b/compute/auth/access_token_test.py index 0e2daa1ec9e..e266b171401 100644 --- a/compute/auth/access_token_test.py +++ b/compute/auth/access_token_test.py @@ -11,9 +11,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import access_token import mock +import access_token + @mock.patch('access_token.requests') def test_main(requests_mock, cloud_config): diff --git a/compute/autoscaler/demo/frontend_test.py b/compute/autoscaler/demo/frontend_test.py index 09bae5d8e77..41aa9938c98 100644 --- a/compute/autoscaler/demo/frontend_test.py +++ b/compute/autoscaler/demo/frontend_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import frontend import pytest +import frontend + class FakeTime(object): """Fake implementations of GetUserCpuTime, GetUserCpuTime and BusyWait. diff --git a/compute/encryption/generate_wrapped_rsa_key_test.py b/compute/encryption/generate_wrapped_rsa_key_test.py index 92d919e1801..2d5c838272e 100644 --- a/compute/encryption/generate_wrapped_rsa_key_test.py +++ b/compute/encryption/generate_wrapped_rsa_key_test.py @@ -13,10 +13,11 @@ import os -import generate_wrapped_rsa_key from googleapiclient import discovery from oauth2client.client import GoogleCredentials +import generate_wrapped_rsa_key + def test_main(): generate_wrapped_rsa_key.main(None) diff --git a/compute/metadata/main_test.py b/compute/metadata/main_test.py index 7214d308cf9..51ef9bda42e 100644 --- a/compute/metadata/main_test.py +++ b/compute/metadata/main_test.py @@ -11,10 +11,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import mock import requests +import main + @mock.patch('main.requests') def test_wait_for_maintenance(requests_mock): diff --git a/dataproc/dataproc_e2e_test.py b/dataproc/dataproc_e2e_test.py index 56db9b1146b..c69726ce043 100644 --- a/dataproc/dataproc_e2e_test.py +++ b/dataproc/dataproc_e2e_test.py @@ -16,9 +16,10 @@ submits a job to Dataproc that runs the pyspark file, then downloads the output logs from Cloud Storage and verifies the expected output.""" -import create_cluster_and_submit_job from gcp.testing.flaky import flaky +import create_cluster_and_submit_job + CLUSTER_NAME = 'testcluster2' ZONE = 'us-central1-b' diff --git a/datastore/api/snippets_test.py b/datastore/api/snippets_test.py index f334e751296..09bebbb264d 100644 --- a/datastore/api/snippets_test.py +++ b/datastore/api/snippets_test.py @@ -15,6 +15,7 @@ from gcp.testing import eventually_consistent from gcp.testing.flaky import flaky import pytest + import snippets diff --git a/datastore/api/tasks_test.py b/datastore/api/tasks_test.py index e60479676ef..33104518a39 100644 --- a/datastore/api/tasks_test.py +++ b/datastore/api/tasks_test.py @@ -15,6 +15,7 @@ from gcp.testing import eventually_consistent from gcp.testing.flaky import flaky import pytest + import tasks diff --git a/dns/api/main_test.py b/dns/api/main_test.py index 5cf216b6c3a..91282ad60e9 100644 --- a/dns/api/main_test.py +++ b/dns/api/main_test.py @@ -13,9 +13,10 @@ from gcloud import dns from gcp.testing.flaky import flaky -import main import pytest +import main + TEST_ZONE_NAME = 'test-zone' TEST_ZONE_DNS_NAME = 'theadora.is.' TEST_ZONE_DESCRIPTION = 'Test zone' diff --git a/error_reporting/main_test.py b/error_reporting/main_test.py index 15064742a7a..11a24d03543 100644 --- a/error_reporting/main_test.py +++ b/error_reporting/main_test.py @@ -12,9 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import main import mock +import main + @mock.patch("fluent.event") def test_error_sends(event_mock): diff --git a/language/movie_nl/main_test.py b/language/movie_nl/main_test.py index fc69e9bccfe..8e22a1da34e 100644 --- a/language/movie_nl/main_test.py +++ b/language/movie_nl/main_test.py @@ -14,9 +14,10 @@ import json -import main import six +import main + def test_get_request_body(): text = 'hello world' diff --git a/logging/cloud-client/export_test.py b/logging/cloud-client/export_test.py index 5a0218aaaee..d4dfd681ea3 100644 --- a/logging/cloud-client/export_test.py +++ b/logging/cloud-client/export_test.py @@ -15,11 +15,12 @@ import random import string -import export from gcloud import logging from gcp.testing import eventually_consistent import pytest +import export + TEST_SINK_NAME_TMPL = 'example_sink_{}' TEST_SINK_FILTER = 'severity>=CRITICAL' diff --git a/logging/cloud-client/snippets_test.py b/logging/cloud-client/snippets_test.py index 6a1004d4609..f41f52fb557 100644 --- a/logging/cloud-client/snippets_test.py +++ b/logging/cloud-client/snippets_test.py @@ -15,6 +15,7 @@ from gcloud import logging from gcp.testing import eventually_consistent import pytest + import snippets TEST_LOGGER_NAME = 'example_log' diff --git a/monitoring/api/v3/custom_metric_test.py b/monitoring/api/v3/custom_metric_test.py index 6a6a193a924..6fdfd635962 100644 --- a/monitoring/api/v3/custom_metric_test.py +++ b/monitoring/api/v3/custom_metric_test.py @@ -23,10 +23,11 @@ import random import time -from custom_metric import create_custom_metric, get_custom_metric -from custom_metric import read_timeseries, write_timeseries_value from gcp.testing import eventually_consistent from gcp.testing.flaky import flaky + +from custom_metric import create_custom_metric, get_custom_metric +from custom_metric import read_timeseries, write_timeseries_value import list_resources """ Custom metric domain for all custom metrics""" diff --git a/monitoring/api/v3/list_resources_test.py b/monitoring/api/v3/list_resources_test.py index f4cf351e07b..750b57406a6 100644 --- a/monitoring/api/v3/list_resources_test.py +++ b/monitoring/api/v3/list_resources_test.py @@ -23,6 +23,7 @@ import re from gcp.testing.flaky import flaky + import list_resources METRIC = 'compute.googleapis.com/instance/cpu/usage_time' diff --git a/speech/api/speech_async_grpc_test.py b/speech/api/speech_async_grpc_test.py index 4329bba8ff8..56c268212c8 100644 --- a/speech/api/speech_async_grpc_test.py +++ b/speech/api/speech_async_grpc_test.py @@ -15,6 +15,7 @@ import re import pytest + from speech_async_grpc import _gcs_uri from speech_async_grpc import main diff --git a/speech/api/speech_grpc_test.py b/speech/api/speech_grpc_test.py index 9e9eb7915c7..ef6cee19e94 100644 --- a/speech/api/speech_grpc_test.py +++ b/speech/api/speech_grpc_test.py @@ -14,6 +14,7 @@ import re import pytest + from speech_grpc import _gcs_uri from speech_grpc import main diff --git a/storage/api/customer_supplied_keys_test.py b/storage/api/customer_supplied_keys_test.py index 85062e642e5..fe0a6db038a 100644 --- a/storage/api/customer_supplied_keys_test.py +++ b/storage/api/customer_supplied_keys_test.py @@ -13,9 +13,10 @@ import re -from customer_supplied_keys import main from gcp.testing.flaky import flaky +from customer_supplied_keys import main + @flaky def test_main(cloud_config, capsys): diff --git a/storage/cloud-client/encryption_test.py b/storage/cloud-client/encryption_test.py index ddef282b8f2..52d3e6d15d9 100644 --- a/storage/cloud-client/encryption_test.py +++ b/storage/cloud-client/encryption_test.py @@ -15,10 +15,11 @@ import base64 import tempfile -import encryption from gcloud import storage import pytest +import encryption + TEST_ENCRYPTION_KEY = 'brtJUWneL92g5q0N2gyDSnlPSYAiIVZ/cWgjyZNeMy0=' TEST_ENCRYPTION_KEY_DECODED = base64.b64decode(TEST_ENCRYPTION_KEY) diff --git a/storage/cloud-client/snippets_test.py b/storage/cloud-client/snippets_test.py index b38aa438038..f215d275487 100644 --- a/storage/cloud-client/snippets_test.py +++ b/storage/cloud-client/snippets_test.py @@ -18,6 +18,7 @@ from gcloud import storage import pytest import requests + import snippets diff --git a/vision/api/face_detection/faces_test.py b/vision/api/face_detection/faces_test.py index 43a0075856d..9611c82ed49 100644 --- a/vision/api/face_detection/faces_test.py +++ b/vision/api/face_detection/faces_test.py @@ -13,9 +13,10 @@ import os -from faces import main from PIL import Image +from faces import main + def test_main(resource, tmpdir): out_file = os.path.join(tmpdir.dirname, 'face-output.jpg') From fadffb50c411b63c7a533bd350992aba83d6b869 Mon Sep 17 00:00:00 2001 From: Jon Wayne Parrott Date: Fri, 19 Aug 2016 14:13:21 -0700 Subject: [PATCH 3/4] bump Change-Id: I02e7767d13ba267ee9fc72c5b68a57013bb8b8d3 From 94690fe372c70c5655ebbd0db4ae207e505aef8a Mon Sep 17 00:00:00 2001 From: Jon Wayne Parrott Date: Fri, 19 Aug 2016 14:34:51 -0700 Subject: [PATCH 4/4] Remove unnecessary arg Change-Id: I287e80fc29dd945716c8ce51dc52612d36a42ef3 --- nox.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nox.py b/nox.py index 8aba6fa0eb4..92692f04a7e 100644 --- a/nox.py +++ b/nox.py @@ -219,8 +219,7 @@ def session_travis(session, subsession): print('\n'.join(sample_directories)) run_tests_in_sesssion( - session, interpreter, sample_directories, - skip_flaky=True, changed_only=True) + session, interpreter, sample_directories, skip_flaky=True) def session_lint(session):