10000 Merge branch 'master' into darcy.rayner/dd-trace-support · DataDog/datadog-lambda-python@76c3632 · GitHub
[go: up one dir, main page]

Skip to content

Commit 76c3632

Browse files
committed
Merge branch 'master' into darcy.rayner/dd-trace-support
2 parents 7e8d8b9 + a230373 commit 76c3632

File tree

5 files changed

+26
-8
lines changed

5 files changed

+26
-8
lines changed

.circleci/config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ jobs:
3232
command: |
3333
source venv/bin/activate
3434
flake8 datadog_lambda/
35+
- run:
36+
name: Check Formatting
37+
command: |
38+
source venv/bin/activate
39+
./scripts/check_format.sh
3540
3641
- save_cache:
3742
paths:

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Datadog Lambda Layer for Python (2.7, 3.6, 3.7 and 3.8) enables custom metric su
1010

1111
## IMPORTANT NOTE
1212

13-
AWS Lambda is expected to recieve a [breaking change](https://aws.amazon.com/blogs/compute/upcoming-changes-to-the-python-sdk-in-aws-lambda/) on **March 30th, 2020**. If you are using Datadog Python Lambda layer version 7 or below, please upgrade to version 11.
13+
AWS Lambda is expected to recieve a [breaking change](https://aws.amazon.com/blogs/compute/upcoming-changes-to-the-python-sdk-in-aws-lambda/) on **January 30, 2021**. If you are using Datadog Python Lambda layer version 7 or below, please upgrade to version 11.
1414

1515
## Installation
1616

scripts/check_format.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/sh
2+
set -e
3+
4+
PYTHON_VERSION=$(python -c 'import sys; print(sys.version_info.major)')
5+
if [ "$PYTHON_VERSION" = "2" ]; then
6+
echo "Skipping formatting, black not compatible with python 2"
7+
exit 0
8+
fi
9+
pip install -Iv black==19.10b0
10+
11+
python -m black --check datadog_lambda/
12+
python -m black --check tests
13+
14+
15+

tests/test_patch.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
import sys
22
import unittest
3+
34
try:
45
from unittest.mock import patch
56
except ImportError:
67
from mock import patch
78

8-
from datadog_lambda.patch import (
9-
_patch_httplib,
10-
_ensure_patch_requests,
11-
)
9+
from datadog_lambda.patch import _patch_httplib, _ensure_patch_requests
1210
from datadog_lambda.constants import TraceHeader
1311

1412

1513
class TestPatchHTTPClients(unittest.TestCase):
16-
1714
def setUp(self):
1815
patcher = patch("datadog_lambda.patch.get_dd_trace_context")
1916
self.mock_get_dd_trace_context = patcher.start()
@@ -36,6 +33,7 @@ def test_patch_httplib(self):
3633
def test_patch_requests(self):
3734
_ensure_patch_requests()
3835
import requests
36+
3937
r = requests.get("https://www.datadoghq.com/")
4038
self.mock_get_dd_trace_context.assert_called()
4139
self.assertEqual(r.request.headers[TraceHeader.TRACE_ID], "123")
@@ -45,6 +43,7 @@ def test_patch_requests(self):
4543
def test_patch_requests_with_headers(self):
4644
_ensure_patch_requests()
4745
import requests
46+
4847
r = requests.get("https://www.datadoghq.com/", headers={"key": "value"})
4948
self.mock_get_dd_trace_context.assert_called()
5049
self.assertEqual(r.request.headers["key"], "value")
@@ -55,6 +54,7 @@ def test_patch_requests_with_headers(self):
5554
def test_patch_requests_with_headers_none(self):
5655
_ensure_patch_requests()
5756
import requests
57+
5858
r = requests.get("https://www.datadoghq.com/", headers=None)
5959
self.mock_get_dd_trace_context.assert_called()
6060
self.assertEqual(r.request.headers[TraceHeader.TRACE_ID], "123")

tests/test_tracing.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ def test_convert_xray_sampling(self):
179179

180180
class TestLogsInjection(unittest.TestCase):
181181
def setUp(self):
182-
183182
patcher = patch("datadog_lambda.tracing.get_dd_trace_context")
184183
self.mock_get_dd_trace_context = patcher.start()
185184
self.mock_get_dd_trace_context.return_value = {
@@ -198,4 +197,3 @@ def test_set_correlation_ids(self):
198197
trace_id, span_id = get_correlation_ids()
199198
self.assertEqual(trace_id, "123")
200199
self.assertEqual(span_id, "456")
201-

0 commit comments

Comments
 (0)
0