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 2c9e53b4fda6..8aba6fa0eb44 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 59b3f8ba365e..2b9b4b66c42a 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 44fb434a4980..7c6fe2e1f108 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 43e9a2be3e11..0a62c87a7338 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 175a863172b8..d8a0a1efff29 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 3d4b7336d404..c2911415275a 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 fb4562d6cace..f314c04487af 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 88f710e824bd..76391d74f642 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 e69de29bb2d1..000000000000 diff --git a/appengine/standard/app_identity/asserting/main_test.py b/appengine/standard/app_identity/asserting/main_test.py index 33c03a75ecde..66169aa2b828 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 0365a52327db..38faaa3f015e 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 2c2fdbc7bc8d..4864f9a18db9 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 6909d802cf6a..9cceda3d317e 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 55cf5bfe47f4..139f528adde8 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 77e192b2dac5..470eddf13d20 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 2b62074dae49..adfc579698e9 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 f2debea7a960..b08fddac57a4 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 55a5b836a322..487a68db5140 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 56fefa2ead66..c8255a90d304 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 56fefa2ead66..c8255a90d304 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 1f058098db3b..64670c5981db 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 a0f5e0d4129d..d6b3f4e698f3 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 2cad660af474..33caf1fa2f0a 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 f3315973587e..8ef5dfc73393 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 439243f7b351..03476add6ec7 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 3f0f38b1ee8a..181f788d33af 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 d94415b12059..d808a2cbc34a 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 4935c5999f17..da514ef0e72d 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 f068ed64617b..5e5f7e6be021 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 640dc6efbb39..d56f58e0d6fe 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 d855ce7e140b..c386f2ace158 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 de92f476f292..91980afe8677 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 74363741fc15..ca0883f362e2 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 d1f034db123a..125054be64c5 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 794188b8aa11..fe1b4b7acc80 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 be70621692bb..b2441c4331ff 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 c23ee61f2d9b..f1cb8d0a1d62 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 977004c1abee..1851b78db884 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 fae6ae872a6c..8d34d8f408b2 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 5d82f5a8298b..e4022c95586d 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 97f0a6f029ed..6ea602d425b1 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 3c3dcc2f2848..ff23e9b301f1 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 97bc7504e176..27410ad2b4dd 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 c0f658bc2ac3..636478a41b06 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 ba0af15c3ed4..57c84c185719 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 3f42385f40c2..27ed85b68d94 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 4833d316296d..967a1474451b 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 418c12d35c63..e1c51a714763 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 7cfacfed4da6..78f519baba6e 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 ec117568daa0..257525895ee0 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 b779ad96a05d..e93ffc6b81a2 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 0ec40949d1c3..1afe71682dfe 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 66c983ac4d5d..a2a4d5a3bd93 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 cae2c6bedc70..49afc670c575 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 14d4359a2988..8310132d133f 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 6abe11e8d426..1851b78db884 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 0ef4b63fcecf..8aa621620fa5 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 d9da413a8d54..9ddfcd269024 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 c53d48cde3b2..d8e6ddef79c3 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 43c6349bbbeb..cd19af5bffca 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 ffed54a69e27..c978856824f6 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 e4e002118803..3d22bbb5561f 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 918493fc8e14..72c128fd71ae 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 e68fe66a16dd..7bb5c8c595ba 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 7303e7da30c3..09a19abbd72e 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 15991cf6404a..6bda3e2f40e4 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 cff5c985f78f..ed729a969b4b 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 aa84d48649db..4ffdf21dfac3 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 d695faa4e7fe..e6cb557f35fc 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 ed670505778c..ddbd8bacd00c 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 72a410691999..33636fc9e30f 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 e8265f4a4007..d52c1e3e883b 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 ca4d1ea38e9f..544adb94aded 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 6e7fc4323db6..988af935ac3d 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 16f41c883ec4..04eb0c4a8fed 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 f85dcf09d0e1..b458b46387f7 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 0e2daa1ec9ef..e266b1714011 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 09bae5d8e77f..41aa9938c98a 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 92d919e1801b..2d5c838272e7 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 7214d308cf97..51ef9bda42ec 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 56db9b1146b7..c69726ce043b 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 f334e7512964..09bebbb264da 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 e60479676ef2..33104518a399 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 5cf216b6c3ac..91282ad60e9f 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 15064742a7aa..11a24d035438 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 fc69e9bccfea..8e22a1da34e7 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 5a0218aaaeee..d4dfd681ea31 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 6a1004d46090..f41f52fb5575 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 6a6a193a9243..6fdfd635962d 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 f4cf351e07bb..750b57406a64 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 4329bba8ff8b..56c268212c80 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 9e9eb7915c7c..ef6cee19e947 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 85062e642e57..fe0a6db038a5 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 ddef282b8f23..52d3e6d15d91 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 b38aa438038d..f215d2754870 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 43a0075856d9..9611c82ed499 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 8aba6fa0eb44..92692f04a7e1 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):