diff --git a/.isort.cfg b/.isort.cfg index 8fefe85dc..b608ac6d2 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -13,5 +13,5 @@ line_length=79 ; docs: https://github.com/timothycrosley/isort#multi-line-output-modes multi_line_output=3 known_future_library = six,six.moves,__future__ -known_third_party=google,google.rpc +known_third_party=google,mock,pymysql,sqlalchemy,psycopg2 known_first_party=opencensus diff --git a/contrib/opencensus-ext-azure/tests/test_azure_log_exporter.py b/contrib/opencensus-ext-azure/tests/test_azure_log_exporter.py index 4e6892f56..15c361cbd 100644 --- a/contrib/opencensus-ext-azure/tests/test_azure_log_exporter.py +++ b/contrib/opencensus-ext-azure/tests/test_azure_log_exporter.py @@ -18,6 +18,7 @@ import unittest import mock + from opencensus.ext.azure import log_exporter TEST_FOLDER = os.path.abspath('.test.logs') diff --git a/contrib/opencensus-ext-azure/tests/test_azure_metrics_exporter.py b/contrib/opencensus-ext-azure/tests/test_azure_metrics_exporter.py index f2a0a9273..63c802e0d 100644 --- a/contrib/opencensus-ext-azure/tests/test_azure_metrics_exporter.py +++ b/contrib/opencensus-ext-azure/tests/test_azure_metrics_exporter.py @@ -16,6 +16,7 @@ from datetime import datetime import mock + from opencensus.common import utils from opencensus.ext.azure import metrics_exporter from opencensus.ext.azure.common import Options diff --git a/contrib/opencensus-ext-azure/tests/test_azure_standard_metrics.py b/contrib/opencensus-ext-azure/tests/test_azure_standard_metrics.py index cff79f0e7..2a01ca90b 100644 --- a/contrib/opencensus-ext-azure/tests/test_azure_standard_metrics.py +++ b/contrib/opencensus-ext-azure/tests/test_azure_standard_metrics.py @@ -17,6 +17,7 @@ import unittest import mock + import requests from opencensus.ext.azure.metrics_exporter import standard_metrics from opencensus.trace import execution_context diff --git a/contrib/opencensus-ext-azure/tests/test_azure_trace_exporter.py b/contrib/opencensus-ext-azure/tests/test_azure_trace_exporter.py index 76faf5ce3..935a52a7e 100644 --- a/contrib/opencensus-ext-azure/tests/test_azure_trace_exporter.py +++ b/contrib/opencensus-ext-azure/tests/test_azure_trace_exporter.py @@ -18,6 +18,7 @@ import unittest import mock + from opencensus.ext.azure import trace_exporter TEST_FOLDER = os.path.abspath('.test.exporter') diff --git a/contrib/opencensus-ext-azure/tests/test_storage.py b/contrib/opencensus-ext-azure/tests/test_storage.py index e32a4e5d0..b5776926d 100644 --- a/contrib/opencensus-ext-azure/tests/test_storage.py +++ b/contrib/opencensus-ext-azure/tests/test_storage.py @@ -17,6 +17,7 @@ import unittest import mock + from opencensus.ext.azure.common.storage import ( LocalFileBlob, LocalFileStorage, diff --git a/contrib/opencensus-ext-datadog/tests/traces_test.py b/contrib/opencensus-ext-datadog/tests/traces_test.py index fdb8d11a7..cc3799694 100644 --- a/contrib/opencensus-ext-datadog/tests/traces_test.py +++ b/contrib/opencensus-ext-datadog/tests/traces_test.py @@ -1,6 +1,7 @@ import unittest import mock + from opencensus.ext.datadog.traces import ( DatadogTraceExporter, Options, diff --git a/contrib/opencensus-ext-datadog/tests/transport_test.py b/contrib/opencensus-ext-datadog/tests/transport_test.py index d963b9553..56cd5b318 100644 --- a/contrib/opencensus-ext-datadog/tests/transport_test.py +++ b/contrib/opencensus-ext-datadog/tests/transport_test.py @@ -1,6 +1,7 @@ import unittest import mock + from opencensus.ext.datadog.transport import DDTransport diff --git a/contrib/opencensus-ext-dbapi/tests/test_dbapi_trace.py b/contrib/opencensus-ext-dbapi/tests/test_dbapi_trace.py index ef057dcda..3ac633a10 100644 --- a/contrib/opencensus-ext-dbapi/tests/test_dbapi_trace.py +++ b/contrib/opencensus-ext-dbapi/tests/test_dbapi_trace.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.ext.dbapi import trace diff --git a/contrib/opencensus-ext-django/examples/app/views.py b/contrib/opencensus-ext-django/examples/app/views.py index c4a6dc31b..7ce641f5e 100644 --- a/contrib/opencensus-ext-django/examples/app/views.py +++ b/contrib/opencensus-ext-django/examples/app/views.py @@ -14,10 +14,11 @@ import os -import mysql.connector import psycopg2 -import requests import sqlalchemy + +import mysql.connector +import requests from django.http import HttpResponse from django.shortcuts import render from opencensus.trace import config_integration diff --git a/contrib/opencensus-ext-django/tests/test_django_db_middleware.py b/contrib/opencensus-ext-django/tests/test_django_db_middleware.py index 8772a1177..553f2c5e8 100644 --- a/contrib/opencensus-ext-django/tests/test_django_db_middleware.py +++ b/contrib/opencensus-ext-django/tests/test_django_db_middleware.py @@ -15,8 +15,9 @@ import unittest from collections import namedtuple -import django import mock + +import django import pytest from django.test.utils import teardown_test_environment from opencensus.trace import execution_context diff --git a/contrib/opencensus-ext-django/tests/test_django_middleware.py b/contrib/opencensus-ext-django/tests/test_django_middleware.py index 146b0f693..57e0d98f8 100644 --- a/contrib/opencensus-ext-django/tests/test_django_middleware.py +++ b/contrib/opencensus-ext-django/tests/test_django_middleware.py @@ -15,6 +15,7 @@ import unittest import mock + from django.test import RequestFactory from django.test.utils import teardown_test_environment from opencensus.trace import execution_context, print_exporter, samplers diff --git a/contrib/opencensus-ext-flask/examples/custom.py b/contrib/opencensus-ext-flask/examples/custom.py index 342e8c122..066421c6a 100644 --- a/contrib/opencensus-ext-flask/examples/custom.py +++ b/contrib/opencensus-ext-flask/examples/custom.py @@ -14,14 +14,15 @@ import os +import psycopg2 +import sqlalchemy + import flask import grpc import hello_world_pb2 import hello_world_pb2_grpc import mysql.connector -import psycopg2 import requests -import sqlalchemy from opencensus.ext.flask.flask_middleware import FlaskMiddleware from opencensus.ext.grpc import client_interceptor from opencensus.ext.stackdriver import trace_exporter as stackdriver_exporter diff --git a/contrib/opencensus-ext-flask/tests/test_flask_middleware.py b/contrib/opencensus-ext-flask/tests/test_flask_middleware.py index 316390cb5..fb0021638 100644 --- a/contrib/opencensus-ext-flask/tests/test_flask_middleware.py +++ b/contrib/opencensus-ext-flask/tests/test_flask_middleware.py @@ -17,10 +17,10 @@ import unittest +import mock from google.rpc import code_pb2 import flask -import mock from opencensus.ext.flask import flask_middleware from opencensus.trace import execution_context, print_exporter, samplers from opencensus.trace import span as span_module diff --git a/contrib/opencensus-ext-gevent/tests/test_patching.py b/contrib/opencensus-ext-gevent/tests/test_patching.py index ae03866d5..76e711c6c 100644 --- a/contrib/opencensus-ext-gevent/tests/test_patching.py +++ b/contrib/opencensus-ext-gevent/tests/test_patching.py @@ -14,8 +14,9 @@ import unittest -import gevent.monkey import mock + +import gevent.monkey import opencensus.common.runtime_context as runtime_context diff --git a/contrib/opencensus-ext-google-cloud-clientlibs/tests/test_google_cloud_clientlibs_trace.py b/contrib/opencensus-ext-google-cloud-clientlibs/tests/test_google_cloud_clientlibs_trace.py index 0bba82a0c..20b0836e3 100644 --- a/contrib/opencensus-ext-google-cloud-clientlibs/tests/test_google_cloud_clientlibs_trace.py +++ b/contrib/opencensus-ext-google-cloud-clientlibs/tests/test_google_cloud_clientlibs_trace.py @@ -14,8 +14,9 @@ import unittest -import grpc import mock + +import grpc from opencensus.ext.google_cloud_clientlibs import trace diff --git a/contrib/opencensus-ext-grpc/tests/test_client_interceptor.py b/contrib/opencensus-ext-grpc/tests/test_client_interceptor.py index 1e90e454a..0c1a22bdd 100644 --- a/contrib/opencensus-ext-grpc/tests/test_client_interceptor.py +++ b/contrib/opencensus-ext-grpc/tests/test_client_interceptor.py @@ -16,11 +16,11 @@ import threading import unittest +import mock from google.api_core import bidi from google.protobuf import proto_builder import grpc -import mock from grpc.framework.foundation import logging_pool from opencensus.ext.grpc import client_interceptor from opencensus.trace import execution_context diff --git a/contrib/opencensus-ext-grpc/tests/test_server_interceptor.py b/contrib/opencensus-ext-grpc/tests/test_server_interceptor.py index 6dba7556b..680de1002 100644 --- a/contrib/opencensus-ext-grpc/tests/test_server_interceptor.py +++ b/contrib/opencensus-ext-grpc/tests/test_server_interceptor.py @@ -14,9 +14,9 @@ import unittest +import mock from google.rpc import code_pb2 -import mock from opencensus.ext.grpc import server_interceptor from opencensus.ext.grpc import utils as grpc_utils from opencensus.trace import execution_context diff --git a/contrib/opencensus-ext-httplib/tests/test_httplib_trace.py b/contrib/opencensus-ext-httplib/tests/test_httplib_trace.py index 8f36b2b54..e85bfecdd 100644 --- a/contrib/opencensus-ext-httplib/tests/test_httplib_trace.py +++ b/contrib/opencensus-ext-httplib/tests/test_httplib_trace.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.ext.httplib import trace from opencensus.trace import span as span_module from opencensus.trace.propagation import trace_context_http_header_format diff --git a/contrib/opencensus-ext-jaeger/tests/test_jaeger_exporter.py b/contrib/opencensus-ext-jaeger/tests/test_jaeger_exporter.py index b1f0e96c8..85c4b924f 100644 --- a/contrib/opencensus-ext-jaeger/tests/test_jaeger_exporter.py +++ b/contrib/opencensus-ext-jaeger/tests/test_jaeger_exporter.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.ext.jaeger import trace_exporter from opencensus.ext.jaeger.trace_exporter.gen.jaeger import jaeger from opencensus.trace import ( diff --git a/contrib/opencensus-ext-mysql/tests/test_mysql_trace.py b/contrib/opencensus-ext-mysql/tests/test_mysql_trace.py index 3aa23ee3d..04e11caa4 100644 --- a/contrib/opencensus-ext-mysql/tests/test_mysql_trace.py +++ b/contrib/opencensus-ext-mysql/tests/test_mysql_trace.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.ext.mysql import trace diff --git a/contrib/opencensus-ext-ocagent/tests/test_stats_exporter.py b/contrib/opencensus-ext-ocagent/tests/test_stats_exporter.py index 4fcf24307..f7f395149 100644 --- a/contrib/opencensus-ext-ocagent/tests/test_stats_exporter.py +++ b/contrib/opencensus-ext-ocagent/tests/test_stats_exporter.py @@ -20,10 +20,10 @@ from concurrent import futures from datetime import datetime +import mock from google.protobuf import timestamp_pb2 import grpc -import mock from opencensus.common import resource, utils from opencensus.common.version import __version__ as opencensus_version from opencensus.ext.ocagent import stats_exporter as ocagent diff --git a/contrib/opencensus-ext-ocagent/tests/test_trace_exporter.py b/contrib/opencensus-ext-ocagent/tests/test_trace_exporter.py index 3a5749857..a1c665633 100644 --- a/contrib/opencensus-ext-ocagent/tests/test_trace_exporter.py +++ b/contrib/opencensus-ext-ocagent/tests/test_trace_exporter.py @@ -17,8 +17,9 @@ import socket import unittest -import grpc import mock + +import grpc from opencensus.common.version import __version__ from opencensus.ext.ocagent.trace_exporter import TraceExporter from opencensus.proto.trace.v1 import trace_config_pb2 diff --git a/contrib/opencensus-ext-postgresql/opencensus/ext/postgresql/trace.py b/contrib/opencensus-ext-postgresql/opencensus/ext/postgresql/trace.py index a27505ddb..5ae2ce9fc 100644 --- a/contrib/opencensus-ext-postgresql/opencensus/ext/postgresql/trace.py +++ b/contrib/opencensus-ext-postgresql/opencensus/ext/postgresql/trace.py @@ -16,11 +16,12 @@ import logging import psycopg2 -from opencensus.trace import execution_context -from opencensus.trace import span as span_module from psycopg2 import connect as pg_connect from psycopg2.extensions import cursor as pgcursor +from opencensus.trace import execution_context +from opencensus.trace import span as span_module + log = logging.getLogger(__name__) MODULE_NAME = 'postgresql' diff --git a/contrib/opencensus-ext-postgresql/tests/test_postgresql_trace.py b/contrib/opencensus-ext-postgresql/tests/test_postgresql_trace.py index 81b0ffef1..28555de8b 100644 --- a/contrib/opencensus-ext-postgresql/tests/test_postgresql_trace.py +++ b/contrib/opencensus-ext-postgresql/tests/test_postgresql_trace.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.ext.postgresql import trace diff --git a/contrib/opencensus-ext-prometheus/tests/test_prometheus_stats.py b/contrib/opencensus-ext-prometheus/tests/test_prometheus_stats.py index 5f53e6b75..7746792e8 100644 --- a/contrib/opencensus-ext-prometheus/tests/test_prometheus_stats.py +++ b/contrib/opencensus-ext-prometheus/tests/test_prometheus_stats.py @@ -16,6 +16,7 @@ from datetime import datetime import mock + from opencensus.ext.prometheus import stats_exporter as prometheus from opencensus.stats import aggregation as aggregation_module from opencensus.stats import measure as measure_module diff --git a/contrib/opencensus-ext-pymongo/tests/test_pymongo_trace.py b/contrib/opencensus-ext-pymongo/tests/test_pymongo_trace.py index 041602f48..a8e15250e 100644 --- a/contrib/opencensus-ext-pymongo/tests/test_pymongo_trace.py +++ b/contrib/opencensus-ext-pymongo/tests/test_pymongo_trace.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.ext.pymongo import trace diff --git a/contrib/opencensus-ext-pymysql/opencensus/ext/pymysql/trace.py b/contrib/opencensus-ext-pymysql/opencensus/ext/pymysql/trace.py index e3c89ac09..3fbd7db31 100644 --- a/contrib/opencensus-ext-pymysql/opencensus/ext/pymysql/trace.py +++ b/contrib/opencensus-ext-pymysql/opencensus/ext/pymysql/trace.py @@ -16,6 +16,7 @@ import logging import pymysql + from opencensus.ext.dbapi import trace MODULE_NAME = 'pymysql' diff --git a/contrib/opencensus-ext-pymysql/tests/test_pymysql_trace.py b/contrib/opencensus-ext-pymysql/tests/test_pymysql_trace.py index 292d15051..015ffe2ae 100644 --- a/contrib/opencensus-ext-pymysql/tests/test_pymysql_trace.py +++ b/contrib/opencensus-ext-pymysql/tests/test_pymysql_trace.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.ext.pymysql import trace diff --git a/contrib/opencensus-ext-pyramid/tests/test_pyramid_config.py b/contrib/opencensus-ext-pyramid/tests/test_pyramid_config.py index 23a6f221b..f31ad66e9 100644 --- a/contrib/opencensus-ext-pyramid/tests/test_pyramid_config.py +++ b/contrib/opencensus-ext-pyramid/tests/test_pyramid_config.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.ext.pyramid import config diff --git a/contrib/opencensus-ext-pyramid/tests/test_pyramid_middleware.py b/contrib/opencensus-ext-pyramid/tests/test_pyramid_middleware.py index 02f1192d6..deb58e4b5 100644 --- a/contrib/opencensus-ext-pyramid/tests/test_pyramid_middleware.py +++ b/contrib/opencensus-ext-pyramid/tests/test_pyramid_middleware.py @@ -18,6 +18,7 @@ import unittest import mock + from opencensus.common.transports import sync from opencensus.ext.pyramid import pyramid_middleware from opencensus.ext.zipkin import trace_exporter as zipkin_exporter diff --git a/contrib/opencensus-ext-requests/tests/test_requests_trace.py b/contrib/opencensus-ext-requests/tests/test_requests_trace.py index 4fbdbd8e4..8747e0ebe 100644 --- a/contrib/opencensus-ext-requests/tests/test_requests_trace.py +++ b/contrib/opencensus-ext-requests/tests/test_requests_trace.py @@ -15,6 +15,7 @@ import unittest import mock + import requests from opencensus.ext.requests import trace from opencensus.trace import execution_context diff --git a/contrib/opencensus-ext-sqlalchemy/opencensus/ext/sqlalchemy/trace.py b/contrib/opencensus-ext-sqlalchemy/opencensus/ext/sqlalchemy/trace.py index 025897b3a..bba541106 100644 --- a/contrib/opencensus-ext-sqlalchemy/opencensus/ext/sqlalchemy/trace.py +++ b/contrib/opencensus-ext-sqlalchemy/opencensus/ext/sqlalchemy/trace.py @@ -14,9 +14,10 @@ import logging +from sqlalchemy import engine, event + from opencensus.trace import execution_context from opencensus.trace import span as span_module -from sqlalchemy import engine, event log = logging.getLogger(__name__) diff --git a/contrib/opencensus-ext-sqlalchemy/tests/test_sqlalchemy_trace.py b/contrib/opencensus-ext-sqlalchemy/tests/test_sqlalchemy_trace.py index 9ffc9a9e5..9df47e415 100644 --- a/contrib/opencensus-ext-sqlalchemy/tests/test_sqlalchemy_trace.py +++ b/contrib/opencensus-ext-sqlalchemy/tests/test_sqlalchemy_trace.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.ext.sqlalchemy import trace from opencensus.trace import span as span_module diff --git a/contrib/opencensus-ext-stackdriver/tests/test_stackdriver_exporter.py b/contrib/opencensus-ext-stackdriver/tests/test_stackdriver_exporter.py index 70029e999..c48e21681 100644 --- a/contrib/opencensus-ext-stackdriver/tests/test_stackdriver_exporter.py +++ b/contrib/opencensus-ext-stackdriver/tests/test_stackdriver_exporter.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.common.version import __version__ from opencensus.ext.stackdriver import trace_exporter from opencensus.trace import span_context diff --git a/contrib/opencensus-ext-stackdriver/tests/test_stackdriver_stats.py b/contrib/opencensus-ext-stackdriver/tests/test_stackdriver_stats.py index 024c4a227..fd3b517c6 100644 --- a/contrib/opencensus-ext-stackdriver/tests/test_stackdriver_stats.py +++ b/contrib/opencensus-ext-stackdriver/tests/test_stackdriver_stats.py @@ -16,9 +16,9 @@ from datetime import datetime import google.auth +import mock from google.cloud import monitoring_v3 -import mock from opencensus.common import utils from opencensus.common.version import __version__ from opencensus.ext.stackdriver import stats_exporter as stackdriver diff --git a/contrib/opencensus-ext-threading/tests/test_threading_trace.py b/contrib/opencensus-ext-threading/tests/test_threading_trace.py index 96045adee..6985f7b8b 100644 --- a/contrib/opencensus-ext-threading/tests/test_threading_trace.py +++ b/contrib/opencensus-ext-threading/tests/test_threading_trace.py @@ -18,6 +18,7 @@ from multiprocessing.pool import Pool import mock + from opencensus.ext.threading import trace from opencensus.trace import execution_context, tracer diff --git a/contrib/opencensus-ext-zipkin/tests/test_zipkin_exporter.py b/contrib/opencensus-ext-zipkin/tests/test_zipkin_exporter.py index 64c88ad44..607d13c3c 100644 --- a/contrib/opencensus-ext-zipkin/tests/test_zipkin_exporter.py +++ b/contrib/opencensus-ext-zipkin/tests/test_zipkin_exporter.py @@ -16,6 +16,7 @@ from datetime import datetime import mock + from opencensus.ext.zipkin import trace_exporter from opencensus.trace import span_context from opencensus.trace import span_data as span_data_module diff --git a/tests/system/stats/stackdriver/stackdriver_stats_test.py b/tests/system/stats/stackdriver/stackdriver_stats_test.py index 98955700c..783a2d252 100644 --- a/tests/system/stats/stackdriver/stackdriver_stats_test.py +++ b/tests/system/stats/stackdriver/stackdriver_stats_test.py @@ -17,9 +17,9 @@ import sys import time +import mock from google.cloud import monitoring_v3 -import mock from opencensus.ext.stackdriver import stats_exporter as stackdriver from opencensus.metrics import transport from opencensus.stats import aggregation as aggregation_module diff --git a/tests/system/trace/django/app/views.py b/tests/system/trace/django/app/views.py index e6c2fde5f..9f03bab30 100644 --- a/tests/system/trace/django/app/views.py +++ b/tests/system/trace/django/app/views.py @@ -14,9 +14,10 @@ import os -import mysql.connector import psycopg2 import sqlalchemy + +import mysql.connector from django.http import HttpResponse from django.shortcuts import render from opencensus.trace import config_integration diff --git a/tests/system/trace/flask/main.py b/tests/system/trace/flask/main.py index 6a08dda69..e6b93af83 100644 --- a/tests/system/trace/flask/main.py +++ b/tests/system/trace/flask/main.py @@ -14,10 +14,11 @@ import os -import flask -import mysql.connector import psycopg2 import sqlalchemy + +import flask +import mysql.connector from opencensus.common.transports import async_ from opencensus.ext.flask.flask_middleware import FlaskMiddleware from opencensus.ext.stackdriver import trace_exporter as stackdriver_exporter diff --git a/tests/unit/common/monitored_resource_util/test_aws_identity_doc_utils.py b/tests/unit/common/monitored_resource_util/test_aws_identity_doc_utils.py index 64eada3b3..5658b862e 100644 --- a/tests/unit/common/monitored_resource_util/test_aws_identity_doc_utils.py +++ b/tests/unit/common/monitored_resource_util/test_aws_identity_doc_utils.py @@ -16,6 +16,7 @@ import unittest import mock + from opencensus.common.monitored_resource import aws_identity_doc_utils diff --git a/tests/unit/common/monitored_resource_util/test_gcp_metadata_config.py b/tests/unit/common/monitored_resource_util/test_gcp_metadata_config.py index 2e56b6266..d636bcf77 100644 --- a/tests/unit/common/monitored_resource_util/test_gcp_metadata_config.py +++ b/tests/unit/common/monitored_resource_util/test_gcp_metadata_config.py @@ -16,6 +16,7 @@ import unittest import mock + from opencensus.common.monitored_resource import gcp_metadata_config diff --git a/tests/unit/common/monitored_resource_util/test_k8s_utils.py b/tests/unit/common/monitored_resource_util/test_k8s_utils.py index dcb453437..efdc13b4c 100644 --- a/tests/unit/common/monitored_resource_util/test_k8s_utils.py +++ b/tests/unit/common/monitored_resource_util/test_k8s_utils.py @@ -16,6 +16,7 @@ import unittest import mock + from opencensus.common.monitored_resource import k8s_utils diff --git a/tests/unit/common/monitored_resource_util/test_monitored_resource.py b/tests/unit/common/monitored_resource_util/test_monitored_resource.py index 683c9c131..38a1fe4b5 100644 --- a/tests/unit/common/monitored_resource_util/test_monitored_resource.py +++ b/tests/unit/common/monitored_resource_util/test_monitored_resource.py @@ -17,6 +17,7 @@ from contextlib import contextmanager import mock + from opencensus.common.monitored_resource import monitored_resource if sys.version_info < (3,): diff --git a/tests/unit/common/test_http_handler.py b/tests/unit/common/test_http_handler.py index fc2671f4b..cfabbc066 100644 --- a/tests/unit/common/test_http_handler.py +++ b/tests/unit/common/test_http_handler.py @@ -17,6 +17,7 @@ import unittest import mock + from opencensus.common.http_handler import get_request try: diff --git a/tests/unit/common/test_resource.py b/tests/unit/common/test_resource.py index d871978ec..682000c4a 100644 --- a/tests/unit/common/test_resource.py +++ b/tests/unit/common/test_resource.py @@ -18,6 +18,7 @@ import unittest import mock + from opencensus.common import resource as resource_module from opencensus.common.resource import Resource diff --git a/tests/unit/common/test_utils.py b/tests/unit/common/test_utils.py index 68c493bcb..49419afa9 100644 --- a/tests/unit/common/test_utils.py +++ b/tests/unit/common/test_utils.py @@ -30,6 +30,7 @@ import weakref import mock + from opencensus.common import utils diff --git a/tests/unit/common/transports/test_async.py b/tests/unit/common/transports/test_async.py index 14eab47e9..ce8e3ab0b 100644 --- a/tests/unit/common/transports/test_async.py +++ b/tests/unit/common/transports/test_async.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.common.transports import async_ diff --git a/tests/unit/common/transports/test_sync.py b/tests/unit/common/transports/test_sync.py index c3dde41c5..c812b025e 100644 --- a/tests/unit/common/transports/test_sync.py +++ b/tests/unit/common/transports/test_sync.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.common.transports import sync diff --git a/tests/unit/log/test_log.py b/tests/unit/log/test_log.py index ff2dd2326..528d9e7bd 100644 --- a/tests/unit/log/test_log.py +++ b/tests/unit/log/test_log.py @@ -17,6 +17,7 @@ from contextlib import contextmanager import mock + from opencensus import log if sys.version_info < (3,): diff --git a/tests/unit/metrics/export/test_cumulative.py b/tests/unit/metrics/export/test_cumulative.py index dae36caee..0a7dc4ebb 100644 --- a/tests/unit/metrics/export/test_cumulative.py +++ b/tests/unit/metrics/export/test_cumulative.py @@ -15,6 +15,7 @@ import unittest from mock import Mock + from opencensus.metrics.export import cumulative, gauge, metric_descriptor from opencensus.metrics.export import value as value_module diff --git a/tests/unit/metrics/export/test_gauge.py b/tests/unit/metrics/export/test_gauge.py index 1b45b2383..59fafd5ef 100644 --- a/tests/unit/metrics/export/test_gauge.py +++ b/tests/unit/metrics/export/test_gauge.py @@ -16,6 +16,7 @@ import unittest from mock import Mock + from opencensus.metrics.export import gauge, metric_descriptor from opencensus.metrics.export import value as value_module diff --git a/tests/unit/metrics/test_transport.py b/tests/unit/metrics/test_transport.py index 9040c9485..630f90669 100644 --- a/tests/unit/metrics/test_transport.py +++ b/tests/unit/metrics/test_transport.py @@ -17,6 +17,7 @@ import time import mock + from opencensus.metrics import transport if sys.version_info < (3,): diff --git a/tests/unit/stats/test_aggregation.py b/tests/unit/stats/test_aggregation.py index 9ef29d92f..671c1910d 100644 --- a/tests/unit/stats/test_aggregation.py +++ b/tests/unit/stats/test_aggregation.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.metrics.export import value from opencensus.stats import aggregation as aggregation_module from opencensus.stats import measure as measure_module diff --git a/tests/unit/stats/test_aggregation_data.py b/tests/unit/stats/test_aggregation_data.py index 0c40a1d26..d1870f2c9 100644 --- a/tests/unit/stats/test_aggregation_data.py +++ b/tests/unit/stats/test_aggregation_data.py @@ -17,6 +17,7 @@ from datetime import datetime import mock + from opencensus.metrics.export import point from opencensus.metrics.export import value as value_module from opencensus.stats import aggregation_data as aggregation_data_module diff --git a/tests/unit/stats/test_base_stats.py b/tests/unit/stats/test_base_stats.py index 5f6ca73aa..1d403c7dc 100644 --- a/tests/unit/stats/test_base_stats.py +++ b/tests/unit/stats/test_base_stats.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.stats import base_exporter diff --git a/tests/unit/stats/test_measure_to_view_map.py b/tests/unit/stats/test_measure_to_view_map.py index 13de4f4a2..a754baf04 100644 --- a/tests/unit/stats/test_measure_to_view_map.py +++ b/tests/unit/stats/test_measure_to_view_map.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.stats import measure_to_view_map as measure_to_view_map_module from opencensus.stats.aggregation import CountAggregation from opencensus.stats.measure import BaseMeasure, MeasureInt diff --git a/tests/unit/stats/test_measurement_map.py b/tests/unit/stats/test_measurement_map.py index f101ddb47..89add276b 100644 --- a/tests/unit/stats/test_measurement_map.py +++ b/tests/unit/stats/test_measurement_map.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.stats import measurement_map as measurement_map_module from opencensus.tags import Tag, TagContext, TagMap diff --git a/tests/unit/stats/test_metric_utils.py b/tests/unit/stats/test_metric_utils.py index da6710e94..355f0da2e 100644 --- a/tests/unit/stats/test_metric_utils.py +++ b/tests/unit/stats/test_metric_utils.py @@ -16,6 +16,7 @@ import unittest import mock + from opencensus.metrics.export import metric_descriptor, point, value from opencensus.stats import ( aggregation, diff --git a/tests/unit/stats/test_stats_recorder.py b/tests/unit/stats/test_stats_recorder.py index 4af9000c9..ce22597e9 100644 --- a/tests/unit/stats/test_stats_recorder.py +++ b/tests/unit/stats/test_stats_recorder.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.stats import execution_context from opencensus.stats import stats_recorder as stats_recorder_module from opencensus.stats.measurement_map import MeasurementMap diff --git a/tests/unit/stats/test_view.py b/tests/unit/stats/test_view.py index bb1680afa..c6d2849a3 100644 --- a/tests/unit/stats/test_view.py +++ b/tests/unit/stats/test_view.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.metrics.export import metric_descriptor from opencensus.stats import aggregation, measure from opencensus.stats import view as view_module diff --git a/tests/unit/stats/test_view_data.py b/tests/unit/stats/test_view_data.py index ce35bed58..87791802a 100644 --- a/tests/unit/stats/test_view_data.py +++ b/tests/unit/stats/test_view_data.py @@ -16,6 +16,7 @@ from datetime import datetime import mock + from opencensus.common import utils from opencensus.stats import aggregation as aggregation_module from opencensus.stats import measure as measure_module diff --git a/tests/unit/stats/test_view_manager.py b/tests/unit/stats/test_view_manager.py index 7169fbfe7..b6dea72bc 100644 --- a/tests/unit/stats/test_view_manager.py +++ b/tests/unit/stats/test_view_manager.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.stats import execution_context from opencensus.stats import view_manager as view_manager_module from opencensus.stats.measure_to_view_map import MeasureToViewMap diff --git a/tests/unit/trace/exporters/test_logging_exporter.py b/tests/unit/trace/exporters/test_logging_exporter.py index 07e034da0..4dd45e938 100644 --- a/tests/unit/trace/exporters/test_logging_exporter.py +++ b/tests/unit/trace/exporters/test_logging_exporter.py @@ -16,6 +16,7 @@ import unittest import mock + from opencensus.trace import logging_exporter, span_context from opencensus.trace import span_data as span_data_module diff --git a/tests/unit/trace/propagation/test_b3_format.py b/tests/unit/trace/propagation/test_b3_format.py index 52db11b84..68feb20f0 100644 --- a/tests/unit/trace/propagation/test_b3_format.py +++ b/tests/unit/trace/propagation/test_b3_format.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.trace.propagation import b3_format from opencensus.trace.span_context import INVALID_SPAN_ID diff --git a/tests/unit/trace/propagation/test_binary_format.py b/tests/unit/trace/propagation/test_binary_format.py index 093d61914..077864a35 100644 --- a/tests/unit/trace/propagation/test_binary_format.py +++ b/tests/unit/trace/propagation/test_binary_format.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.trace.propagation import binary_format diff --git a/tests/unit/trace/propagation/test_text_format.py b/tests/unit/trace/propagation/test_text_format.py index e8cbfcb30..4a19dce47 100644 --- a/tests/unit/trace/propagation/test_text_format.py +++ b/tests/unit/trace/propagation/test_text_format.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.trace.propagation import text_format diff --git a/tests/unit/trace/samplers/test_probability.py b/tests/unit/trace/samplers/test_probability.py index 2cdec9dc4..165716ce6 100644 --- a/tests/unit/trace/samplers/test_probability.py +++ b/tests/unit/trace/samplers/test_probability.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.trace import samplers diff --git a/tests/unit/trace/test_attributes.py b/tests/unit/trace/test_attributes.py index 06bb15d45..018cdc47c 100644 --- a/tests/unit/trace/test_attributes.py +++ b/tests/unit/trace/test_attributes.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.trace import attributes as attributes_module diff --git a/tests/unit/trace/test_base_span.py b/tests/unit/trace/test_base_span.py index 0978b6738..d27bc6826 100644 --- a/tests/unit/trace/test_base_span.py +++ b/tests/unit/trace/test_base_span.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.trace.base_span import BaseSpan diff --git a/tests/unit/trace/test_blank_span.py b/tests/unit/trace/test_blank_span.py index f8ec81cfb..d9d1e1c15 100644 --- a/tests/unit/trace/test_blank_span.py +++ b/tests/unit/trace/test_blank_span.py @@ -16,6 +16,7 @@ import unittest import mock + from opencensus.common import utils from opencensus.trace.link import Link from opencensus.trace.span import format_span_json diff --git a/tests/unit/trace/test_config_integration.py b/tests/unit/trace/test_config_integration.py index 63e1a3725..548c8fd96 100644 --- a/tests/unit/trace/test_config_integration.py +++ b/tests/unit/trace/test_config_integration.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.trace import config_integration diff --git a/tests/unit/trace/test_execution_context.py b/tests/unit/trace/test_execution_context.py index fa843927f..9df5e7d1f 100644 --- a/tests/unit/trace/test_execution_context.py +++ b/tests/unit/trace/test_execution_context.py @@ -16,6 +16,7 @@ import unittest import mock + from opencensus.trace import execution_context diff --git a/tests/unit/trace/test_ext_utils.py b/tests/unit/trace/test_ext_utils.py index 59cfef7e5..0816b2d7e 100644 --- a/tests/unit/trace/test_ext_utils.py +++ b/tests/unit/trace/test_ext_utils.py @@ -14,9 +14,9 @@ import unittest +import mock from google.rpc import code_pb2 -import mock from opencensus.trace import utils diff --git a/tests/unit/trace/test_link.py b/tests/unit/trace/test_link.py index c39ff0769..a8d6def22 100644 --- a/tests/unit/trace/test_link.py +++ b/tests/unit/trace/test_link.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.trace import link as link_module diff --git a/tests/unit/trace/test_span.py b/tests/unit/trace/test_span.py index 96ab15150..75637ad88 100644 --- a/tests/unit/trace/test_span.py +++ b/tests/unit/trace/test_span.py @@ -16,9 +16,9 @@ import unittest from collections import OrderedDict +import mock from google.rpc import code_pb2 -import mock from opencensus.common import utils from opencensus.trace.span import BoundedDict, BoundedList from opencensus.trace.stack_trace import StackTrace diff --git a/tests/unit/trace/test_stack_trace.py b/tests/unit/trace/test_stack_trace.py index bf6a97364..a33a1895c 100644 --- a/tests/unit/trace/test_stack_trace.py +++ b/tests/unit/trace/test_stack_trace.py @@ -16,6 +16,7 @@ import unittest import mock + from opencensus.trace import stack_trace as stack_trace_module diff --git a/tests/unit/trace/test_time_event.py b/tests/unit/trace/test_time_event.py index 2772db917..063dfb4ad 100644 --- a/tests/unit/trace/test_time_event.py +++ b/tests/unit/trace/test_time_event.py @@ -16,6 +16,7 @@ from datetime import datetime import mock + from opencensus.trace import time_event as time_event_module diff --git a/tests/unit/trace/test_tracer.py b/tests/unit/trace/test_tracer.py index e8b43ec03..82b9a16a3 100644 --- a/tests/unit/trace/test_tracer.py +++ b/tests/unit/trace/test_tracer.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.trace import samplers, span_data from opencensus.trace import tracer as tracer_module diff --git a/tests/unit/trace/tracers/test_context_tracer.py b/tests/unit/trace/tracers/test_context_tracer.py index 3dbf4c85a..1898fb37f 100644 --- a/tests/unit/trace/tracers/test_context_tracer.py +++ b/tests/unit/trace/tracers/test_context_tracer.py @@ -15,6 +15,7 @@ import unittest import mock + from opencensus.trace import execution_context, span from opencensus.trace.tracers import context_tracer