Skip to content

Commit 346f43b

Browse files
authored
Merge branch '0.24-dev' into remove-nose
2 parents a911082 + 624f8c7 commit 346f43b

File tree

7 files changed

+36
-59
lines changed

7 files changed

+36
-59
lines changed

.circleci/config.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,11 @@ jobs:
253253
steps:
254254
- checkout
255255
- *restore_cache_step
256-
- run: tox -e 'aiohttp_contrib-{py34,py35,py36}-aiohttp{12,13,20,21,22}-aiohttp_jinja{012,013}-yarl' --result-json /tmp/aiohttp.1.results
257-
- run: tox -e 'aiohttp_contrib-{py34,py35,py36}-aiohttp{23}-aiohttp_jinja{015}-yarl10' --result-json /tmp/aiohttp.2.results
256+
- run: tox -e 'aiohttp_contrib-{py34,py35,py36}-aiohttp{12,13,20,21,22}-aiohttp_jinja{012,013}-yarl,aiohttp_contrib-{py34,py35,py36}-aiohttp23-aiohttp_jinja015-yarl10,aiohttp_contrib-{py35,py36}-aiohttp{30,31,32,33,34,35}-aiohttp_jinja015-yarl10' --result-json /tmp/aiohttp.results
258257
- persist_to_workspace:
259258
root: /tmp
260259
paths:
261-
- aiohttp.1.results
262-
- aiohttp.2.results
260+
- aiohttp.results
263261
- *save_cache_step
264262

265263
tornado:

README.md

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -46,29 +46,9 @@ launch them through:
4646
[docker-compose]: https://www.docker.com/products/docker-compose
4747

4848

49-
#### Running the Tests in your local environment
50-
51-
Once docker is up and running you should be able to run the tests. To launch a
52-
single test manually. For example to run the tests for `redis-py` 2.10 on Python
53-
3.5 and 3.6:
54-
55-
$ tox -e '{py35,py36}-redis{210}'
56-
57-
To see the defined test commands see `tox.ini`.
58-
59-
To launch the complete test matrix run:
60-
61-
$ tox
62-
63-
6449
#### Running Tests in docker
6550

66-
If you prefer not to setup your local machine to run tests, we provide a preconfigured docker image.
67-
Note that this image is the same used in CircleCI to run tests.
68-
69-
You still need docker containers running additional services up and running.
70-
71-
Run the test runner
51+
Once your docker-compose environment is running, you can run the test runner image:
7252

7353
$ docker-compose run --rm testrunner
7454

ddtrace/sampler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(self, sample_rate=1):
3838

3939
self.set_sample_rate(sample_rate)
4040

41-
log.info("initialized RateSampler, sample %s%% of traces", 100 * sample_rate)
41+
log.debug("initialized RateSampler, sample %s%% of traces", 100 * sample_rate)
4242

4343
def set_sample_rate(self, sample_rate):
4444
self.sample_rate = sample_rate

tests/contrib/aiohttp/app/web.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ def delayed_handler(request):
9494

9595
@asyncio.coroutine
9696
def noop_middleware(app, handler):
97+
@asyncio.coroutine
9798
def middleware_handler(request):
9899
# noop middleware
99100
response = yield from handler(request)

tests/contrib/aiohttp/test_request_safety.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,13 @@ def make_requests():
6767
ctx = self.tracer.get_call_context()
6868
threads = [threading.Thread(target=make_requests) for _ in range(10)]
6969
for t in threads:
70-
t.daemon = True
7170
t.start()
7271

73-
# we should yield so that this loop can handle
74-
# threads' requests
75-
yield from asyncio.sleep(0.5)
7672
for t in threads:
77-
t.join(timeout=0.5)
73+
# we should yield so that this loop can handle
74+
# threads' requests
75+
yield from asyncio.sleep(0.1)
76+
t.join(0.1)
7877

7978
# the trace is wrong but the Context is finished
8079
traces = self.tracer.writer.pop_traces()

tests/opentracer/test_tracer_asyncio.py

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,34 @@
88
from ddtrace.opentracer.utils import get_context_provider_for_scope_manager
99

1010
from tests.contrib.asyncio.utils import AsyncioTestCase, mark_asyncio
11-
from .conftest import dd_tracer, ot_tracer_factory, writer
11+
from .conftest import ot_tracer_factory
1212

1313

1414
@pytest.fixture()
15-
def ot_tracer(ot_tracer_factory):
16-
return ot_tracer_factory(
15+
def ot_tracer(request, ot_tracer_factory):
16+
# use the dummy asyncio ot tracer
17+
request.instance.ot_tracer = ot_tracer_factory(
1718
"asyncio_svc",
1819
config={},
1920
scope_manager=AsyncioScopeManager(),
2021
context_provider=ddtrace.contrib.asyncio.context_provider,
2122
)
23+
request.instance.ot_writer = request.instance.ot_tracer._dd_tracer.writer
24+
request.instance.dd_tracer = request.instance.ot_tracer._dd_tracer
2225

23-
26+
@pytest.mark.usefixtures("ot_tracer")
2427
class TestTracerAsyncio(AsyncioTestCase):
25-
def setUp(self):
26-
super(TestTracerAsyncio, self).setUp()
27-
28-
# use the dummy asyncio ot tracer
29-
self.tracer = ot_tracer(ot_tracer_factory())
30-
self.writer = writer(self.tracer)
3128

3229
def reset(self):
33-
self.writer.pop_traces()
30+
self.ot_writer.pop_traces()
3431

3532
@mark_asyncio
3633
def test_trace_coroutine(self):
3734
# it should use the task context when invoked in a coroutine
38-
with self.tracer.start_span("coroutine"):
35+
with self.ot_tracer.start_span("coroutine"):
3936
pass
4037

41-
traces = self.writer.pop_traces()
38+
traces = self.ot_writer.pop_traces()
4239

4340
assert len(traces) == 1
4441
assert len(traces[0]) == 1
@@ -51,16 +48,16 @@ def test_trace_multiple_coroutines(self):
5148
@asyncio.coroutine
5249
def coro():
5350
# another traced coroutine
54-
with self.tracer.start_active_span("coroutine_2"):
51+
with self.ot_tracer.start_active_span("coroutine_2"):
5552
return 42
5653

57-
with self.tracer.start_active_span("coroutine_1"):
54+
with self.ot_tracer.start_active_span("coroutine_1"):
5855
value = yield from coro()
5956

6057
# the coroutine has been called correctly
6158
assert value == 42
6259
# a single trace has been properly reported
63-
traces = self.writer.pop_traces()
60+
traces = self.ot_writer.pop_traces()
6461
assert len(traces) == 1
6562
assert len(traces[0]) == 2
6663
assert traces[0][0].name == "coroutine_1"
@@ -73,13 +70,13 @@ def coro():
7370
def test_exception(self):
7471
@asyncio.coroutine
7572
def f1():
76-
with self.tracer.start_span("f1"):
73+
with self.ot_tracer.start_span("f1"):
7774
raise Exception("f1 error")
7875

7976
with pytest.raises(Exception):
8077
yield from f1()
8178

82-
traces = self.writer.pop_traces()
79+
traces = self.ot_writer.pop_traces()
8380
assert len(traces) == 1
8481
spans = traces[0]
8582
assert len(spans) == 1
@@ -95,29 +92,24 @@ def test_trace_multiple_calls(self):
9592
@asyncio.coroutine
9693
def coro():
9794
# another traced coroutine
98-
with self.tracer.start_span("coroutine"):
95+
with self.ot_tracer.start_span("coroutine"):
9996
yield from asyncio.sleep(0.01)
10097

10198
futures = [asyncio.ensure_future(coro()) for x in range(10)]
10299
for future in futures:
103100
yield from future
104101

105-
traces = self.writer.pop_traces()
102+
traces = self.ot_writer.pop_traces()
106103

107104
assert len(traces) == 10
108105
assert len(traces[0]) == 1
109106
assert traces[0][0].name == "coroutine"
110107

111108

109+
@pytest.mark.usefixtures("ot_tracer")
112110
class TestTracerAsyncioCompatibility(AsyncioTestCase):
113111
"""Ensure the opentracer works in tandem with the ddtracer and asyncio."""
114112

115-
def setUp(self):
116-
super(TestTracerAsyncioCompatibility, self).setUp()
117-
self.ot_tracer = ot_tracer(ot_tracer_factory())
118-
self.dd_tracer = dd_tracer(self.ot_tracer)
119-
self.writer = writer(self.ot_tracer)
120-
121113
@mark_asyncio
122114
def test_trace_multiple_coroutines_ot_dd(self):
123115
"""

tox.ini

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ envlist =
3838
aiobotocore_contrib-py34-aiobotocore{02,03,04}
3939
aiobotocore_contrib-{py35,py36}-aiobotocore{02,03,04,05,07,08,09,010}
4040
aiohttp_contrib-{py34,py35,py36}-aiohttp{12,13,20,21,22}-aiohttp_jinja{012,013}-yarl
41-
aiohttp_contrib-{py34,py35,py36}-aiohttp{23}-aiohttp_jinja{015}-yarl10
41+
aiohttp_contrib-{py34,py35,py36}-aiohttp23-aiohttp_jinja{015}-yarl10
42+
aiohttp_contrib-{py35,py36}-aiohttp{30,31,32,33,34,35}-aiohttp_jinja{015}-yarl10
4243
aiopg_contrib-{py34,py35,py36}-aiopg{012,015}
4344
asyncio_contrib-{py34,py35,py36}
4445
boto_contrib-{py27,py34}-boto
@@ -127,7 +128,7 @@ deps =
127128
# distribution build.
128129
!ddtracerun: wrapt
129130
!msgpack03-!msgpack04-!msgpack05-!ddtracerun: msgpack-python
130-
pytest>=3.0.0,<4.0.0
131+
pytest>=3
131132
opentracing
132133
# test dependencies installed in all envs
133134
mock
@@ -155,6 +156,12 @@ deps =
155156
aiohttp21: aiohttp>=2.1,<2.2
156157
aiohttp22: aiohttp>=2.2,<2.3
157158
aiohttp23: aiohttp>=2.3,<2.4
159+
aiohttp30: aiohttp>=3.0,<3.1
160+
aiohttp31: aiohttp>=3.1,<3.2
161+
aiohttp32: aiohttp>=3.2,<3.3
162+
aiohttp33: aiohttp>=3.3,<3.4
163+
aiohttp34: aiohttp>=3.4,<3.5
164+
aiohttp35: aiohttp>=3.5,<3.6
158165
aiohttp_jinja012: aiohttp_jinja2>=0.12,<0.13
159166
aiohttp_jinja013: aiohttp_jinja2>=0.13,<0.14
160167
aiohttp_jinja015: aiohttp_jinja2>=0.15,<0.16

0 commit comments

Comments
 (0)