diff --git a/jobs/v3/api_client/auto_complete_sample_test.py b/jobs/v3/api_client/auto_complete_sample_test.py index bb00b2c306bd..cec3c7513181 100755 --- a/jobs/v3/api_client/auto_complete_sample_test.py +++ b/jobs/v3/api_client/auto_complete_sample_test.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import pytest import re import backoff +import pytest import auto_complete_sample diff --git a/jobs/v3/api_client/base_company_sample_test.py b/jobs/v3/api_client/base_company_sample_test.py index b07c8623f7b9..42256b3dba14 100755 --- a/jobs/v3/api_client/base_company_sample_test.py +++ b/jobs/v3/api_client/base_company_sample_test.py @@ -11,11 +11,12 @@ # 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 base_company_sample def test_base_company_sample(capsys): - import base_company_sample - import re base_company_sample.run_sample() out, _ = capsys.readouterr() diff --git a/jobs/v3/api_client/base_job_sample_test.py b/jobs/v3/api_client/base_job_sample_test.py index 5f7d8bb1d178..ea384e40e9e7 100755 --- a/jobs/v3/api_client/base_job_sample_test.py +++ b/jobs/v3/api_client/base_job_sample_test.py @@ -12,10 +12,12 @@ # See the License for the specific language governing permissions and # limitations under the License. +import re + +import base_job_sample + def test_base_job_sample(capsys): - import base_job_sample - import re base_job_sample.run_sample() out, _ = capsys.readouterr() diff --git a/jobs/v3/api_client/batch_operation_sample_test.py b/jobs/v3/api_client/batch_operation_sample_test.py index 7628c759cbef..642d91f7e544 100755 --- a/jobs/v3/api_client/batch_operation_sample_test.py +++ b/jobs/v3/api_client/batch_operation_sample_test.py @@ -11,11 +11,12 @@ # 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 batch_operation_sample def test_batch_operation_sample(capsys): - import batch_operation_sample - import re batch_operation_sample.run_sample() out, _ = capsys.readouterr() diff --git a/jobs/v3/api_client/commute_search_sample_test.py b/jobs/v3/api_client/commute_search_sample_test.py index ff94a1361c4f..e5803a8fa14f 100755 --- a/jobs/v3/api_client/commute_search_sample_test.py +++ b/jobs/v3/api_client/commute_search_sample_test.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import pytest import re import backoff +import pytest import commute_search_sample diff --git a/jobs/v3/api_client/custom_attribute_sample_test.py b/jobs/v3/api_client/custom_attribute_sample_test.py index 327c4396ef14..868c718ce136 100755 --- a/jobs/v3/api_client/custom_attribute_sample_test.py +++ b/jobs/v3/api_client/custom_attribute_sample_test.py @@ -11,11 +11,10 @@ # 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 pytest import re import backoff +import pytest import custom_attribute_sample diff --git a/jobs/v3/api_client/email_alert_search_sample_test.py b/jobs/v3/api_client/email_alert_search_sample_test.py index 8057b9a937a0..c12b4e061c1a 100755 --- a/jobs/v3/api_client/email_alert_search_sample_test.py +++ b/jobs/v3/api_client/email_alert_search_sample_test.py @@ -11,11 +11,10 @@ # 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 pytest import re import backoff +import pytest import email_alert_search_sample diff --git a/jobs/v3/api_client/featured_job_search_sample_test.py b/jobs/v3/api_client/featured_job_search_sample_test.py index bb77a03c7237..0491346c36b5 100755 --- a/jobs/v3/api_client/featured_job_search_sample_test.py +++ b/jobs/v3/api_client/featured_job_search_sample_test.py @@ -11,11 +11,10 @@ # 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 pytest import re import backoff +import pytest import featured_job_search_sample diff --git a/jobs/v3/api_client/general_search_sample_test.py b/jobs/v3/api_client/general_search_sample_test.py index 0b9f16708e02..4d5e8442644f 100755 --- a/jobs/v3/api_client/general_search_sample_test.py +++ b/jobs/v3/api_client/general_search_sample_test.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import pytest import re import backoff +import pytest import general_search_sample diff --git a/jobs/v3/api_client/histogram_sample_test.py b/jobs/v3/api_client/histogram_sample_test.py index dece94e26d98..3fb2ea63a848 100755 --- a/jobs/v3/api_client/histogram_sample_test.py +++ b/jobs/v3/api_client/histogram_sample_test.py @@ -11,11 +11,10 @@ # 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 pytest import re import backoff +import pytest import histogram_sample diff --git a/jobs/v3/api_client/location_search_sample_test.py b/jobs/v3/api_client/location_search_sample_test.py index 379c65dc4de3..6284dd9a2b2e 100755 --- a/jobs/v3/api_client/location_search_sample_test.py +++ b/jobs/v3/api_client/location_search_sample_test.py @@ -11,11 +11,10 @@ # 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 pytest import re import backoff +import pytest import location_search_sample diff --git a/jobs/v3/api_client/quickstart_test.py b/jobs/v3/api_client/quickstart_test.py index 4442255038a8..6f2e4c50e095 100644 --- a/jobs/v3/api_client/quickstart_test.py +++ b/jobs/v3/api_client/quickstart_test.py @@ -14,10 +14,11 @@ import pytest +import quickstart + @pytest.mark.flaky def test_quickstart(capsys): - import quickstart quickstart.run_sample() out, _ = capsys.readouterr() diff --git a/kms/api-client/snippets_test.py b/kms/api-client/snippets_test.py index c75b872c4121..795edeb47370 100644 --- a/kms/api-client/snippets_test.py +++ b/kms/api-client/snippets_test.py @@ -16,6 +16,12 @@ import time import uuid +from cryptography.exceptions import InvalidSignature +from cryptography.hazmat.backends import default_backend +from cryptography.hazmat.primitives import hashes, serialization +from cryptography.hazmat.primitives.asymmetric import padding, utils +from google.cloud import kms +from google.cloud.kms_v1.proto import resources_pb2 import pytest from create_key_asymmetric_decrypt import create_key_asymmetric_decrypt @@ -50,14 +56,6 @@ from verify_asymmetric_ec import verify_asymmetric_ec from verify_asymmetric_rsa import verify_asymmetric_rsa -from cryptography.exceptions import InvalidSignature -from cryptography.hazmat.backends import default_backend -from cryptography.hazmat.primitives import hashes, serialization -from cryptography.hazmat.primitives.asymmetric import padding, utils - -from google.cloud import kms -from google.cloud.kms_v1.proto import resources_pb2 - @pytest.fixture(scope="module") def client(): diff --git a/monitoring/api/v3/api-client/custom_metric_test.py b/monitoring/api/v3/api-client/custom_metric_test.py index 36c0725132ff..1a80408c4adf 100644 --- a/monitoring/api/v3/api-client/custom_metric_test.py +++ b/monitoring/api/v3/api-client/custom_metric_test.py @@ -27,8 +27,8 @@ import backoff import googleapiclient.discovery -import pytest from googleapiclient.errors import HttpError +import pytest from custom_metric import create_custom_metric from custom_metric import delete_metric_descriptor diff --git a/monitoring/api/v3/cloud-client/snippets_test.py b/monitoring/api/v3/cloud-client/snippets_test.py index 117026959e3e..18bb7bf58209 100644 --- a/monitoring/api/v3/cloud-client/snippets_test.py +++ b/monitoring/api/v3/cloud-client/snippets_test.py @@ -14,10 +14,10 @@ import os import re -import pytest import backoff from google.api_core.exceptions import NotFound +import pytest import snippets diff --git a/pubsub/cloud-client/quickstart/pub_test.py b/pubsub/cloud-client/quickstart/pub_test.py index b9a6f807f37d..24010c76e830 100644 --- a/pubsub/cloud-client/quickstart/pub_test.py +++ b/pubsub/cloud-client/quickstart/pub_test.py @@ -15,13 +15,14 @@ # limitations under the License. import os -import pytest import uuid from google.api_core.exceptions import AlreadyExists from google.cloud import pubsub_v1 +import pytest + +import pub # noqa -import pub UUID = uuid.uuid4().hex PROJECT = os.environ["GCLOUD_PROJECT"] diff --git a/pubsub/cloud-client/quickstart/sub_test.py b/pubsub/cloud-client/quickstart/sub_test.py index 1b59a3d043ac..2754dc56b5e5 100644 --- a/pubsub/cloud-client/quickstart/sub_test.py +++ b/pubsub/cloud-client/quickstart/sub_test.py @@ -13,16 +13,15 @@ # 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 mock import os -import pytest import uuid from google.api_core.exceptions import AlreadyExists from google.cloud import pubsub_v1 +import mock +import pytest -import sub +import sub # noqa UUID = uuid.uuid4().hex diff --git a/run/hello-broken/main.py b/run/hello-broken/main.py index b1fa073f4465..14dbb9073a37 100644 --- a/run/hello-broken/main.py +++ b/run/hello-broken/main.py @@ -13,11 +13,13 @@ # limitations under the License. # [START run_broken_service] -from flask import Flask import json import os import sys +from flask import Flask + + app = Flask(__name__) diff --git a/run/hello-broken/main_test.py b/run/hello-broken/main_test.py index d775992783f6..9649aaf0d0cb 100644 --- a/run/hello-broken/main_test.py +++ b/run/hello-broken/main_test.py @@ -13,7 +13,9 @@ # limitations under the License. import os + import pytest + import main