File tree Expand file tree Collapse file tree 7 files changed +48
-18
lines changed Expand file tree Collapse file tree 7 files changed +48
-18
lines changed Original file line number Diff line number Diff line change 1313
1414try :
1515 import boto3
16- from moto import mock_sqs
16+ # TODO: Remove branching when we drop support for Python 3.7
17+ import sys
18+ if sys .version_info >= (3 , 8 ):
19+ from moto import mock_aws
20+ else :
21+ from moto import mock_sqs as mock_aws
1722except ImportError :
1823 # Doesn't matter. We won't call routes using boto3
1924 # in test sets that don't install/test for it.
@@ -174,7 +179,7 @@ def boto3_sqs():
174179 os .environ ['AWS_SECURITY_TOKEN' ] = 'testing'
175180 os .environ ['AWS_SESSION_TOKEN' ] = 'testing'
176181
177- with mock_sqs ():
182+ with mock_aws ():
178183 boto3_client = boto3 .client ('sqs' , region_name = 'us-east-1' )
179184 response = boto3_client .create_queue (
180185 QueueName = 'SQS_QUEUE_NAME' ,
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ If you would like to run this test server manually from an ipython console:
44import os
55import urllib3
66
7- from moto import mock_sqs
7+ from moto import mock_aws
88import tests.apps.flask_app
99from tests.helpers import testenv
1010from instana.singletons import tracer
@@ -16,7 +16,7 @@ os.environ['AWS_SECRET_ACCESS_KEY'] = 'testing'
1616os.environ['AWS_SECURITY_TOKEN'] = 'testing'
1717os.environ['AWS_SESSION_TOKEN'] = 'testing'
1818
19- @mock_sqs
19+ @mock_aws
2020def test_app_boto3_sqs():
2121 with tracer.start_active_span('wsgi') as scope:
2222 scope.span.set_tag('span.kind', 'entry')
@@ -26,4 +26,4 @@ def test_app_boto3_sqs():
2626 scope.span.set_tag('http.status_code', 200)
2727 response = http_client.request('GET', testenv["wsgi_server"] + '/boto3/sqs')
2828
29- ```
29+ ```
Original file line number Diff line number Diff line change 77import boto3
88import pytest
99
10- from moto import mock_lambda
10+ # TODO: Remove branching when we drop support for Python 3.7
11+ import sys
12+ if sys .version_info >= (3 , 8 ):
13+ from moto import mock_aws
14+ else :
15+ from moto import mock_sqs as mock_aws
1116
1217from instana .singletons import tracer
1318from ...helpers import get_first_span_by_filter
@@ -24,7 +29,7 @@ def aws_credentials():
2429
2530@pytest .fixture (scope = 'function' )
2631def aws_lambda (aws_credentials ):
27- with mock_lambda ():
32+ with mock_aws ():
2833 yield boto3 .client ('lambda' , region_name = 'us-east-1' )
2934
3035
Original file line number Diff line number Diff line change 77import boto3
88import pytest
99
10- from moto import mock_s3
10+ # TODO: Remove branching when we drop support for Python 3.7
11+ import sys
12+ if sys .version_info >= (3 , 8 ):
13+ from moto import mock_aws
14+ else :
15+ from moto import mock_s3 as mock_aws
1116
1217from instana .singletons import tracer
1318from ...helpers import get_first_span_by_filter
@@ -34,7 +39,7 @@ def aws_credentials():
3439
3540@pytest .fixture (scope = 'function' )
3641def s3 (aws_credentials ):
37- with mock_s3 ():
42+ with mock_aws ():
3843 yield boto3 .client ('s3' , region_name = 'us-east-1' )
3944
4045
Original file line number Diff line number Diff line change 77import boto3
88import pytest
99
10- from moto import mock_secretsmanager
10+ # TODO: Remove branching when we drop support for Python 3.7
11+ import sys
12+ if sys .version_info >= (3 , 8 ):
13+ from moto import mock_aws
14+ else :
15+ from moto import mock_secretsmanager as mock_aws
1116
1217from instana .singletons import tracer
1318from ...helpers import get_first_span_by_filter
@@ -30,7 +35,7 @@ def aws_credentials():
3035
3136@pytest .fixture (scope = 'function' )
3237def secretsmanager (aws_credentials ):
33- with mock_secretsmanager ():
38+ with mock_aws ():
3439 yield boto3 .client ('secretsmanager' , region_name = 'us-east-1' )
3540
3641
@@ -80,4 +85,4 @@ def test_get_secret_value(secretsmanager):
8085
8186 assert boto_span .data ['http' ]['status' ] == 200
8287 assert boto_span .data ['http' ]['method' ] == 'POST'
83- assert boto_span .data ['http' ]['url' ] == 'https://secretsmanager.us-east-1.amazonaws.com:443/GetSecretValue'
88+ assert boto_span .data ['http' ]['url' ] == 'https://secretsmanager.us-east-1.amazonaws.com:443/GetSecretValue'
Original file line number Diff line number Diff line change 77import boto3
88import pytest
99
10- from moto import mock_ses
10+ # TODO: Remove branching when we drop support for Python 3.7
11+ import sys
12+ if sys .version_info >= (3 , 8 ):
13+ from moto import mock_aws
14+ else :
15+ from moto import mock_ses as mock_aws
1116
1217from instana .singletons import tracer
1318from ...helpers import get_first_span_by_filter
@@ -30,7 +35,7 @@ def aws_credentials():
3035
3136@pytest .fixture (scope = 'function' )
3237def ses (aws_credentials ):
33- with mock_ses ():
38+ with mock_aws ():
3439 yield boto3 .client ('ses' , region_name = 'us-east-1' )
3540
3641
@@ -71,4 +76,4 @@ def test_verify_email(ses):
7176
7277 assert boto_span .data ['http' ]['status' ] == 200
7378 assert boto_span .data ['http' ]['method' ] == 'POST'
74- assert boto_span .data ['http' ]['url' ] == 'https://email.us-east-1.amazonaws.com:443/VerifyEmailIdentity'
79+ assert boto_span .data ['http' ]['url' ] == 'https://email.us-east-1.amazonaws.com:443/VerifyEmailIdentity'
Original file line number Diff line number Diff line change 88import pytest
99import urllib3
1010
11- from moto import mock_sqs
11+ # TODO: Remove branching when we drop support for Python 3.7
12+ import sys
13+ if sys .version_info >= (3 , 8 ):
14+ from moto import mock_aws
15+ else :
16+ from moto import mock_sqs as mock_aws
1217
1318import tests .apps .flask_app
1419from instana .singletons import tracer
@@ -38,7 +43,7 @@ def http_client():
3843
3944@pytest .fixture (scope = 'function' )
4045def sqs (aws_credentials ):
41- with mock_sqs ():
46+ with mock_aws ():
4247 yield boto3 .client ('sqs' , region_name = 'us-east-1' )
4348
4449
@@ -113,7 +118,7 @@ def test_send_message(sqs):
113118 assert boto_span .data ['http' ]['url' ] == 'https://sqs.us-east-1.amazonaws.com:443/SendMessage'
114119
115120
116- @mock_sqs
121+ @mock_aws
117122def test_app_boto3_sqs (http_client ):
118123 with tracer .start_active_span ('test' ):
119124 response = http_client .request ('GET' , testenv ["wsgi_server" ] + '/boto3/sqs' )
You can’t perform that action at this time.
0 commit comments