Skip to content

Commit 46aee71

Browse files
authored
Add travis CI along with some bug fixes (#56)
* Add travis CI * fix a broken test on travis server * Fix pynamodb tests * add dummpy tox env vars * Fixed a pynamodb patcher encoding bug under python3.4 and 3.5
1 parent 59bd2d0 commit 46aee71

File tree

6 files changed

+26
-6
lines changed

6 files changed

+26
-6
lines changed

.travis.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
language: python
2+
3+
python:
4+
- "2.7"
5+
- "3.4"
6+
- "3.5"
7+
- "3.6"
8+
9+
install:
10+
- pip install tox
11+
12+
script:
13+
- tox -e $(echo py$TRAVIS_PYTHON_VERSION | tr -d .)

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![Build Status](https://travis-ci.org/aws/aws-xray-sdk-python.svg?branch=master)](https://travis-ci.org/aws/aws-xray-sdk-python)
2+
13
# AWS X-Ray SDK for Python
24

35
![Screenshot of the AWS X-Ray console](/images/example_servicemap.png?raw=true)

aws_xray_sdk/core/recorder.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,7 @@ def record_subsegment(self, wrapped, instance, args, kwargs, name,
393393
stack=stack,
394394
)
395395
elif exception:
396-
if subsegment:
397-
subsegment.add_exception(exception, stack)
396+
subsegment.add_exception(exception, stack)
398397

399398
self.end_subsegment(end_time)
400399

aws_xray_sdk/ext/pynamodb/patch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ def pynamodb_meta_processor(wrapped, instance, args, kwargs, return_value,
5656

5757
subsegment.put_http_meta(http.STATUS, return_value.status_code)
5858

59-
_extract_whitelisted_params(subsegment.name, operation_name,
60-
aws_meta, [None, json.loads(args[0].body)],
59+
_extract_whitelisted_params(subsegment.name, operation_name, aws_meta,
60+
[None, json.loads(args[0].body.decode('utf-8'))],
6161
None, return_value.json())
6262

6363
subsegment.set_aws(aws_meta)

tests/ext/pynamodb/test_pynamodb.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
import botocore.session
21
import pytest
2+
3+
import botocore.session
4+
from botocore import UNSIGNED
5+
from botocore.client import Config
36
from botocore.exceptions import ClientError
47
from pynamodb.attributes import UnicodeAttribute
58
from pynamodb.models import Model
@@ -61,7 +64,8 @@ def test_only_dynamodb_calls_are_traced():
6164
PynamoDB call.
6265
"""
6366
session = botocore.session.get_session()
64-
s3 = session.create_client('s3', region_name='us-west-2')
67+
s3 = session.create_client('s3', region_name='us-west-2',
68+
config=Config(signature_version=UNSIGNED))
6569
try:
6670
s3.get_bucket_location(Bucket='mybucket')
6771
except ClientError:

tox.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ commands =
3131

3232
setenv =
3333
DJANGO_SETTINGS_MODULE = tests.ext.django.app.settings
34+
AWS_SECRET_ACCESS_KEY = fake_key
35+
AWS_ACCESS_KEY_ID=fake_id
3436

3537
[testenv:py35-aiohttp3]
3638
deps =

0 commit comments

Comments
 (0)