Skip to content

Commit

Permalink
Fix unit tests and dependency conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
rapphil committed Aug 21, 2024
1 parent cb7c948 commit 87c4e01
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
1 change: 1 addition & 0 deletions python/src/otel/otel_sdk/nodeps-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ opentelemetry-instrumentation-sqlite3==0.47b0
opentelemetry-instrumentation-starlette==0.47b0
opentelemetry-instrumentation-tornado==0.47b0
opentelemetry-instrumentation-wsgi==0.47b0
opentelemetry-instrumentation-aws-lambda==0.47b0
4 changes: 3 additions & 1 deletion python/src/otel/otel_sdk/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
opentelemetry-sdk==1.26.0
opentelemetry-exporter-otlp-proto-http==1.26.0
opentelemetry-distro==0.47b0
opentelemetry-instrumentation-aws-lambda==0.47b0
opentelemetry-instrumentation==0.47b0
opentelemetry-semantic-conventions == 0.47b0
opentelemetry-propagator-aws-xray==1.0.2
4 changes: 3 additions & 1 deletion python/src/otel/tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Dependencies used in tests only
opentelemetry-test-utils==0.47b0
opentelemetry-instrumentation-aws-lambda==0.47b0
opentelemetry-instrumentation == 0.47b0
opentelemetry-semantic-conventions == 0.47b0
opentelemetry-propagator-aws-xray == 1.0.2
11 changes: 9 additions & 2 deletions python/src/otel/tests/test_otel.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import os
import subprocess
import sys
from importlib import import_module
from importlib import import_module, reload
from shutil import which
from unittest import mock

from opentelemetry import propagate
from opentelemetry.environment_variables import OTEL_PROPAGATORS
from opentelemetry.instrumentation.aws_lambda import (
_HANDLER,
Expand Down Expand Up @@ -209,10 +209,14 @@ def test_active_tracing(self):
**os.environ,
# Using Active tracing
_X_AMZN_TRACE_ID: MOCK_XRAY_TRACE_CONTEXT_SAMPLED,
OTEL_PROPAGATORS: "xray-lambda"
},
)
test_env_patch.start()

# try to load propagators based on the OTEL_PROPAGATORS env var
reload(propagate)

mock_execute_lambda()

spans = self.memory_exporter.get_finished_spans()
Expand Down Expand Up @@ -266,6 +270,9 @@ def test_parent_context_from_lambda_event(self):
)
test_env_patch.start()

# try to load propagators based on the OTEL_PROPAGATORS env var
reload(propagate)

mock_execute_lambda(
{
"headers": {
Expand Down
7 changes: 4 additions & 3 deletions python/src/tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ changedir =
test-instrumentation-aws-lambda: {toxinidir}/otel/tests

commands_pre =
test: pip install -r requirements.txt
pip install -r requirements.txt
pip install --no-deps -r nodeps-requirements.txt

deps =
test: pytest
pytest

commands =
test: pytest {posargs}
pytest {posargs}

0 comments on commit 87c4e01

Please sign in to comment.