Skip to content

Commit

Permalink
Add travis CI along with some bug fixes (#56)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
haotianw465 authored May 4, 2018
1 parent 59bd2d0 commit 46aee71
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 6 deletions.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
language: python

python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"

install:
- pip install tox

script:
- tox -e $(echo py$TRAVIS_PYTHON_VERSION | tr -d .)
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/aws/aws-xray-sdk-python.svg?branch=master)](https://travis-ci.org/aws/aws-xray-sdk-python)

# AWS X-Ray SDK for Python

![Screenshot of the AWS X-Ray console](/images/example_servicemap.png?raw=true)
Expand Down
3 changes: 1 addition & 2 deletions aws_xray_sdk/core/recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,7 @@ def record_subsegment(self, wrapped, instance, args, kwargs, name,
stack=stack,
)
elif exception:
if subsegment:
subsegment.add_exception(exception, stack)
subsegment.add_exception(exception, stack)

self.end_subsegment(end_time)

Expand Down
4 changes: 2 additions & 2 deletions aws_xray_sdk/ext/pynamodb/patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def pynamodb_meta_processor(wrapped, instance, args, kwargs, return_value,

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

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

subsegment.set_aws(aws_meta)
8 changes: 6 additions & 2 deletions tests/ext/pynamodb/test_pynamodb.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import botocore.session
import pytest

import botocore.session
from botocore import UNSIGNED
from botocore.client import Config
from botocore.exceptions import ClientError
from pynamodb.attributes import UnicodeAttribute
from pynamodb.models import Model
Expand Down Expand Up @@ -61,7 +64,8 @@ def test_only_dynamodb_calls_are_traced():
PynamoDB call.
"""
session = botocore.session.get_session()
s3 = session.create_client('s3', region_name='us-west-2')
s3 = session.create_client('s3', region_name='us-west-2',
config=Config(signature_version=UNSIGNED))
try:
s3.get_bucket_location(Bucket='mybucket')
except ClientError:
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ commands =

setenv =
DJANGO_SETTINGS_MODULE = tests.ext.django.app.settings
AWS_SECRET_ACCESS_KEY = fake_key
AWS_ACCESS_KEY_ID=fake_id

[testenv:py35-aiohttp3]
deps =
Expand Down

0 comments on commit 46aee71

Please sign in to comment.