Skip to content

Commit

Permalink
Use local imports when importing from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xrmx committed Apr 26, 2024
1 parent bd4a22a commit eb3e3c8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,6 @@
from typing import Any, Callable, Dict
from unittest import mock

from tests.mocks.api_gateway_http_api_event import (
MOCK_LAMBDA_API_GATEWAY_HTTP_API_EVENT,
)
from tests.mocks.api_gateway_proxy_event import (
MOCK_LAMBDA_API_GATEWAY_PROXY_EVENT,
)

from opentelemetry.environment_variables import OTEL_PROPAGATORS
from opentelemetry.instrumentation.aws_lambda import (
_HANDLER,
Expand All @@ -45,6 +38,11 @@
TraceContextTextMapPropagator,
)

from .mocks.api_gateway_http_api_event import (
MOCK_LAMBDA_API_GATEWAY_HTTP_API_EVENT,
)
from .mocks.api_gateway_proxy_event import MOCK_LAMBDA_API_GATEWAY_PROXY_EVENT


class MockLambdaContext:
def __init__(self, aws_request_id, invoked_function_arn):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
# pylint:disable=cyclic-import

import grpc
from tests.protobuf import ( # pylint: disable=no-name-in-module
test_server_pb2_grpc,
)

import opentelemetry.instrumentation.grpc
from opentelemetry import trace
Expand All @@ -41,6 +38,7 @@
simple_method_future,
)
from ._server import create_test_server
from .protobuf import test_server_pb2_grpc
from .protobuf.test_server_pb2 import Request


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
from unittest import mock

import grpc
from tests.protobuf import ( # pylint: disable=no-name-in-module
test_server_pb2_grpc,
)

import opentelemetry.instrumentation.grpc
from opentelemetry import trace
Expand All @@ -44,6 +41,7 @@
simple_method_future,
)
from ._server import create_test_server
from .protobuf import test_server_pb2_grpc
from .protobuf.test_server_pb2 import Request


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,14 @@
# limitations under the License.

import grpc
from tests.protobuf import ( # pylint: disable=no-name-in-module
test_server_pb2_grpc,
)

from opentelemetry import trace
from opentelemetry.instrumentation.grpc import GrpcInstrumentorClient
from opentelemetry.test.test_base import TestBase

from ._client import simple_method
from ._server import create_test_server
from .protobuf import test_server_pb2_grpc


# User defined interceptor. Is used in the tests along with the opentelemetry client interceptor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@
MemcacheUnknownError,
)

# pylint: disable=import-error,no-name-in-module
from tests.utils import MockSocket, _str

from opentelemetry import trace as trace_api
from opentelemetry.instrumentation.pymemcache import PymemcacheInstrumentor
from opentelemetry.semconv.trace import SpanAttributes
from opentelemetry.test.test_base import TestBase
from opentelemetry.trace import get_tracer

from .utils import MockSocket, _str

TEST_HOST = "localhost"
TEST_PORT = 117711

Expand Down

0 comments on commit eb3e3c8

Please sign in to comment.