Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.

Commit

Permalink
reduce build time
Browse files Browse the repository at this point in the history
  • Loading branch information
whummer committed Sep 1, 2019
1 parent 5eab8f6 commit 6750278
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ install:
script:
- set -e # fail fast
# run tests using Python 3
- DEBUG=1 LAMBDA_EXECUTOR=docker TEST_ERROR_INJECTION=1 make test
- DEBUG=1 LAMBDA_EXECUTOR=docker USE_SSL=1 TEST_ERROR_INJECTION=1 make test
# run tests using Python 2
# Note: we're not using multiple versions in the top-level "python" configuration,
# but instead reinstall using 2.x here, as that allows us to re-use some cached libs etc.
- "make reinstall-p2 > /dev/null"
- make init
- LAMBDA_EXECUTOR=docker-reuse USE_SSL=1 make test
- LAMBDA_EXECUTOR=docker-reuse TEST_PATH="tests/integration/test_lambda.py tests/integration/test_integration.py" make test
# build Docker image
- make docker-build
# run Java tests
Expand Down
17 changes: 13 additions & 4 deletions localstack/utils/testutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,12 @@ def download_s3_object(s3, bucket, path):
with tempfile.SpooledTemporaryFile() as tmpfile:
s3.Bucket(bucket).download_fileobj(path, tmpfile)
tmpfile.seek(0)
return to_str(tmpfile.read())
result = tmpfile.read()
try:
result = to_str(result)
except Exception:
pass
return result


def map_all_s3_objects(to_json=True):
Expand All @@ -194,9 +199,13 @@ def map_all_s3_objects(to_json=True):
for bucket in s3_client.buckets.all():
for key in bucket.objects.all():
value = download_s3_object(s3_client, key.bucket_name, key.key)
if to_json:
value = json.loads(value)
result['%s/%s' % (key.bucket_name, key.key)] = value
try:
if to_json:
value = json.loads(value)
result['%s/%s' % (key.bucket_name, key.key)] = value
except Exception:
# skip non-JSON or binary objects
pass
return result


Expand Down

0 comments on commit 6750278

Please sign in to comment.