16
16
17
17
from pkg_resources import (
18
18
DistributionNotFound ,
19
- EntryPoint ,
20
- get_distribution ,
21
- iter_entry_points
19
+ iter_entry_points ,
22
20
)
23
21
import unittest
24
22
from timeit import default_timer
25
23
from unittest .mock import (
26
24
Mock ,
27
- patch
25
+ patch ,
28
26
)
29
27
import fastapi
30
28
from fastapi .middleware .httpsredirect import HTTPSRedirectMiddleware
31
29
from fastapi .responses import JSONResponse
32
30
from fastapi .testclient import TestClient
33
31
34
32
import opentelemetry .instrumentation .fastapi as otel_fastapi
35
- from opentelemetry .instrumentation .dependencies import (
36
- get_dist_dependency_conflicts ,
37
- get_dependency_conflicts
38
- )
39
33
from opentelemetry import trace
40
34
from opentelemetry .instrumentation .auto_instrumentation ._load import _load_instrumentors
41
35
from opentelemetry .instrumentation ._semconv import (
@@ -1054,8 +1048,6 @@ class TestAutoInstrumentation(TestBaseAutoFastAPI):
1054
1048
to both.
1055
1049
"""
1056
1050
1057
- entry_point = EntryPoint .parse ('fastapi = opentelemetry.instrumentation.fastapi:FastAPIInstrumentor' )
1058
-
1059
1051
def test_entry_point_exists (self ):
1060
1052
eps = iter_entry_points ("opentelemetry_instrumentor" )
1061
1053
ep = next (eps )
@@ -1065,12 +1057,8 @@ def test_entry_point_exists(self):
1065
1057
self .assertEqual (ep .name , 'fastapi' )
1066
1058
self .assertIsNone (next (eps , None ))
1067
1059
1068
- @patch ("opentelemetry.instrumentation.auto_instrumentation._load.get_dist_dependency_conflicts" )
1069
- @patch ("opentelemetry.instrumentation.dependencies.get_dependency_conflicts" )
1070
1060
@patch ("opentelemetry.instrumentation.dependencies.get_distribution" )
1071
- def test_instruments_with_fastapi_installed (self , mock_get_distribution , mock_get_dependency_conflicts , mock_get_dist_dependency_conflicts ):
1072
- mock_get_dist_dependency_conflicts .side_effect = get_dist_dependency_conflicts
1073
- mock_get_dependency_conflicts .side_effect = get_dependency_conflicts
1061
+ def test_instruments_with_fastapi_installed (self , mock_get_distribution ):
1074
1062
mock_get_distribution .side_effect = get_distribution_with_fastapi
1075
1063
mock_distro = Mock ()
1076
1064
_load_instrumentors (mock_distro )
@@ -1083,12 +1071,8 @@ def test_instruments_with_fastapi_installed(self, mock_get_distribution, mock_ge
1083
1071
self .assertEqual (ep .attrs , ('FastAPIInstrumentor' ,))
1084
1072
self .assertEqual (ep .name , 'fastapi' )
1085
1073
1086
- @patch ("opentelemetry.instrumentation.auto_instrumentation._load.get_dist_dependency_conflicts" )
1087
- @patch ("opentelemetry.instrumentation.dependencies.get_dependency_conflicts" )
1088
1074
@patch ("opentelemetry.instrumentation.dependencies.get_distribution" )
1089
- def test_instruments_without_fastapi_installed (self , mock_get_distribution , mock_get_dependency_conflicts , mock_get_dist_dependency_conflicts ):
1090
- mock_get_dist_dependency_conflicts .side_effect = get_dist_dependency_conflicts
1091
- mock_get_dependency_conflicts .side_effect = get_dependency_conflicts
1075
+ def test_instruments_without_fastapi_installed (self , mock_get_distribution ):
1092
1076
mock_get_distribution .side_effect = get_distribution_without_fastapi
1093
1077
mock_distro = Mock ()
1094
1078
_load_instrumentors (mock_distro )
0 commit comments