Skip to content

Commit 54c1437

Browse files
committed
remove intalling gevent for unit testing since it's now mocked
1 parent cad6be7 commit 54c1437

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

aws-opentelemetry-distro/tests/amazon/opentelemetry/distro/patches/test_gevent_patches.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
# SPDX-License-Identifier: Apache-2.0
33
import os
4+
import sys
45
from importlib.metadata import PackageNotFoundError
56
from unittest import TestCase
67
from unittest.mock import MagicMock, patch
78

9+
# Create a mock gevent module that can be imported
10+
# This allows tests to run without gevent installed
11+
_mock_gevent = MagicMock()
12+
_mock_gevent.monkey = MagicMock()
13+
sys.modules['gevent'] = _mock_gevent
14+
sys.modules['gevent.monkey'] = _mock_gevent.monkey
15+
816
from amazon.opentelemetry.distro.patches._gevent_patches import (
917
AWS_GEVENT_PATCH_MODULES,
1018
_is_gevent_installed,

tox.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ commands_pre =
3434
; Install common packages for all the tests. These are not needed in all the
3535
; cases but it saves a lot of boilerplate in this file.
3636
test: pip install botocore
37-
test: pip install gevent
3837
test: pip install opentelemetry-api[test]@{env:CORE_REPO}\#egg=opentelemetry-api&subdirectory=opentelemetry-api
3938
test: pip install opentelemetry-sdk[test]@{env:CORE_REPO}\#egg=opentelemetry-sdk&subdirectory=opentelemetry-sdk
4039
test: pip install opentelemetry-instrumentation[test]@{env:CONTRIB_REPO}\#egg=opentelemetry-instrumentation&subdirectory=opentelemetry-instrumentation

0 commit comments

Comments
 (0)