Skip to content

Commit c5116b1

Browse files
authored
Merge branch '0.24-dev' into update-flake8
2 parents a83684a + 5f28696 commit c5116b1

File tree

4 files changed

+63
-32
lines changed

4 files changed

+63
-32
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ jobs:
740740
steps:
741741
- checkout
742742
- *restore_cache_step
743-
- run: tox -e 'aiobotocore_contrib-{py34,py35,py36}-aiobotocore{02,03,04}' --result-json /tmp/aiobotocore.results
743+
- run: tox -e 'aiobotocore_contrib-py34-aiobotocore{02,03,04},aiobotocore_contrib-{py35,py36}-aiobotocore{02,03,04,05,07,08,09,010}' --result-json /tmp/aiobotocore.results
744744
- persist_to_workspace:
745745
root: /tmp
746746
paths:

tests/contrib/aiobotocore/py35/test.py

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# flake8: noqa
22
# DEV: Skip linting, we lint with Python 2, we'll get SyntaxErrors from `async`
3+
import aiobotocore
34
from nose.tools import eq_
45

56
from ddtrace.contrib.aiobotocore.patch import patch, unpatch
@@ -36,22 +37,37 @@ async def test_response_context_manager(self):
3637
await stream.read()
3738

3839
traces = self.tracer.writer.pop_traces()
39-
eq_(len(traces), 2)
40-
eq_(len(traces[0]), 1)
41-
eq_(len(traces[1]), 1)
42-
43-
span = traces[0][0]
44-
eq_(span.get_tag('aws.operation'), 'GetObject')
45-
eq_(span.get_tag('http.status_code'), '200')
46-
eq_(span.service, 'aws.s3')
47-
eq_(span.resource, 's3.getobject')
48-
49-
read_span = traces[1][0]
50-
eq_(read_span.get_tag('aws.operation'), 'GetObject')
51-
eq_(read_span.get_tag('http.status_code'), '200')
52-
eq_(read_span.service, 'aws.s3')
53-
eq_(read_span.resource, 's3.getobject')
54-
eq_(read_span.name, 's3.command.read')
55-
# enforce parenting
56-
eq_(read_span.parent_id, span.span_id)
57-
eq_(read_span.trace_id, span.trace_id)
40+
41+
version = aiobotocore.__version__.split(".")
42+
pre_08 = int(version[0]) == 0 and int(version[1]) < 8
43+
# Version 0.8+ generates only one span for reading an object.
44+
if pre_08:
45+
eq_(len(traces), 2)
46+
eq_(len(traces[0]), 1)
47+
eq_(len(traces[1]), 1)
48+
49+
span = traces[0][0]
50+
eq_(span.get_tag('aws.operation'), 'GetObject')
51+
eq_(span.get_tag('http.status_code'), '200')
52+
eq_(span.service, 'aws.s3')
53+
eq_(span.resource, 's3.getobject')
54+
55+
read_span = traces[1][0]
56+
eq_(read_span.get_tag('aws.operation'), 'GetObject')
57+
eq_(read_span.get_tag('http.status_code'), '200')
58+
eq_(read_span.service, 'aws.s3')
59+
eq_(read_span.resource, 's3.getobject')
60+
eq_(read_span.name, 's3.command.read')
61+
# enforce parenting
62+
eq_(read_span.parent_id, span.span_id)
63+
eq_(read_span.trace_id, span.trace_id)
64+
else:
65+
eq_(len(traces[0]), 1)
66+
eq_(len(traces[0]), 1)
67+
68+
span = traces[0][0]
69+
eq_(span.get_tag('aws.operation'), 'GetObject')
70+
eq_(span.get_tag('http.status_code'), '200')
71+
eq_(span.service, 'aws.s3')
72+
eq_(span.resource, 's3.getobject')
73+
eq_(span.name, 's3.command')

tests/contrib/aiobotocore/test.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# flake8: noqa
22
# DEV: Skip linting, we lint with Python 2, we'll get SyntaxErrors from `yield from`
3+
import aiobotocore
34
from botocore.errorfactory import ClientError
45

56
from ddtrace.contrib.aiobotocore.patch import patch, unpatch
@@ -125,25 +126,32 @@ def test_s3_client_read(self):
125126
yield from response['Body'].read()
126127

127128
traces = self.tracer.writer.pop_traces()
128-
self.assertEqual(len(traces), 2)
129+
version = aiobotocore.__version__.split(".")
130+
pre_08 = int(version[0]) == 0 and int(version[1]) < 8
131+
if pre_08:
132+
self.assertEqual(len(traces), 2)
133+
self.assertEqual(len(traces[1]), 1)
134+
else:
135+
self.assertEqual(len(traces), 1)
136+
129137
self.assertEqual(len(traces[0]), 1)
130-
self.assertEqual(len(traces[1]), 1)
131138

132139
span = traces[0][0]
133140
self.assertEqual(span.get_tag('aws.operation'), 'GetObject')
134141
self.assertEqual(span.get_tag('http.status_code'), '200')
135142
self.assertEqual(span.service, 'aws.s3')
136143
self.assertEqual(span.resource, 's3.getobject')
137144

138-
read_span = traces[1][0]
139-
self.assertEqual(read_span.get_tag('aws.operation'), 'GetObject')
140-
self.assertEqual(read_span.get_tag('http.status_code'), '200')
141-
self.assertEqual(read_span.service, 'aws.s3')
142-
self.assertEqual(read_span.resource, 's3.getobject')
143-
self.assertEqual(read_span.name, 's3.command.read')
144-
# enforce parenting
145-
self.assertEqual(read_span.parent_id, span.span_id)
146-
self.assertEqual(read_span.trace_id, span.trace_id)
145+
if pre_08:
146+
read_span = traces[1][0]
147+
self.assertEqual(read_span.get_tag('aws.operation'), 'GetObject')
148+
self.assertEqual(read_span.get_tag('http.status_code'), '200')
149+
self.assertEqual(read_span.service, 'aws.s3')
150+
self.assertEqual(read_span.resource, 's3.getobject')
151+
self.assertEqual(read_span.name, 's3.command.read')
152+
# enforce parenting
153+
self.assertEqual(read_span.parent_id, span.span_id)
154+
self.assertEqual(read_span.trace_id, span.trace_id)
147155

148156
@mark_asyncio
149157
def test_sqs_client(self):

tox.ini

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ envlist =
3535
{py27,py34,py35,py36}-test_utils
3636
{py27,py34,py35,py36}-test_logging
3737
# Integrations environments
38-
aiobotocore_contrib-{py34,py35,py36}-aiobotocore{02,03,04}
38+
aiobotocore_contrib-py34-aiobotocore{02,03,04}
39+
aiobotocore_contrib-{py35,py36}-aiobotocore{02,03,04,05,07,08,09,010}
3940
aiohttp_contrib-{py34,py35,py36}-aiohttp{12,13,20,21,22}-aiohttp_jinja{012,013}-yarl
4041
aiohttp_contrib-{py34,py35,py36}-aiohttp{23}-aiohttp_jinja{015}-yarl10
4142
aiopg_contrib-{py34,py35,py36}-aiopg{012,015}
@@ -134,6 +135,12 @@ deps =
134135
yarl: yarl==0.18.0
135136
yarl10: yarl>=1.0,<1.1
136137
# integrations
138+
aiobotocore010: aiobotocore>=0.10,<0.11
139+
aiobotocore09: aiobotocore>=0.9,<0.10
140+
aiobotocore08: aiobotocore>=0.8,<0.9
141+
aiobotocore07: aiobotocore>=0.7,<0.8
142+
# aiobotocore06 does not work
143+
aiobotocore05: aiobotocore>=0.5,<0.6
137144
aiobotocore04: aiobotocore>=0.4,<0.5
138145
aiobotocore03: aiobotocore>=0.3,<0.4
139146
aiobotocore02: aiobotocore>=0.2,<0.3

0 commit comments

Comments
 (0)