File tree Expand file tree Collapse file tree 4 files changed +12
-6
lines changed
Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,6 @@ def patch_all():
3030 _patch_for_integration_tests ()
3131
3232 if config .trace_enabled :
33- # XXX this call is making the tests fail
3433 patch_all_dd ()
3534 else :
3635 _patch_http ()
Original file line number Diff line number Diff line change 88import datadog_lambda .cold_start as cold_start
99import datadog_lambda .wrapper as wrapper
1010
11+ from tests .utils import get_mock_context
12+
1113
1214class TestColdStartTracingSetup (unittest .TestCase ):
1315 def test_proactive_init (self ):
@@ -257,11 +259,7 @@ def finish(span):
257259 def handler (event , context ):
258260 import tabnanny
259261
260- lambda_context = MagicMock ()
261- lambda_context .invoked_function_arn = (
262- "arn:aws:lambda:us-west-1:123457598159:function:python-layer-test:1"
263- )
264- lambda_context .get_remaining_time_in_millis = lambda : 100
262+ lambda_context = get_mock_context ()
265263
266264 handler .cold_start_tracing = True
267265 handler ({}, lambda_context )
Original file line number Diff line number Diff line change 1+ import pytest
12import unittest
23
34from unittest .mock import patch , MagicMock
45
56from datadog_lambda .patch import _patch_http , _ensure_patch_requests
67from datadog_lambda .constants import TraceHeader
78
9+ from ddtrace .contrib .internal .requests .patch import unpatch as unpatch_requests
10+
11+
12+ @pytest .fixture (scope = "module" , autouse = True )
13+ def reset_patches ():
14+ unpatch_requests ()
15+
816
917class TestPatchHTTPClients (unittest .TestCase ):
1018 def setUp (self ):
Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ def get_mock_context(
2222 lambda_context .invoked_function_arn = invoked_function_arn
2323 lambda_context .function_version = function_version
2424 lambda_context .function_name = function_name
25+ lambda_context .get_remaining_time_in_millis = lambda : 100
2526 lambda_context .client_context = ClientContext (custom )
2627 return lambda_context
2728
You can’t perform that action at this time.
0 commit comments