Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: python
dist: bionic
sudo: false
cache: pip
before_install:
- >
pip install --upgrade pip mypy 'attrs==19.2.0'
-r https://raw.githubusercontent.com/aws-cloudformation/aws-cloudformation-rpdk/master/requirements.txt
install:
- pip install . src/
env:
global:
- AWS_DEFAULT_REGION="us-east-1"
script:
- pre-commit run --all-files
jobs:
include:
- python: "3.6"
- python: "3.7"
- python: "3.8"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ The CloudFormation Resource Provider Development Kit (RPDK) allows you to author

This plugin library helps to provide runtime bindings for the execution of your providers by CloudFormation.

[![Build Status](https://travis-ci.com/aws-cloudformation/cloudformation-cli-python-plugin.svg?branch=master)](https://travis-ci.com/aws-cloudformation/cloudformation-cli-python-plugin)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should add a coverage badge too, 100% is quite impressive 😄

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was going to add it, but if we're not doing codecov... maybe we should make our own 🥇


Installation
------------

Expand Down
4 changes: 2 additions & 2 deletions python/rpdk/python/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import shutil
import zipfile
from pathlib import PurePosixPath
from subprocess import CalledProcessError, run as subprocess_run # nosec
from subprocess import PIPE, CalledProcessError, run as subprocess_run # nosec
from tempfile import TemporaryFile

import docker
Expand Down Expand Up @@ -274,7 +274,7 @@ def _pip_build(cls, base_path):
LOG.warning("Starting pip build.")
try:
completed_proc = subprocess_run( # nosec
command, capture_output=True, cwd=base_path, check=True
command, stdout=PIPE, stderr=PIPE, cwd=base_path, check=True
)
except (FileNotFoundError, CalledProcessError) as e:
raise DownstreamError("pip build failed") from e
Expand Down
8 changes: 7 additions & 1 deletion tests/lib/resource_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,13 @@ class Unserializable:
HandlerErrorCode.InternalFailure,
"Object of type Unserializable is not JSON serializable",
)
assert serialized == event._serialize()
try:
# Python 3.7/3.8
assert serialized == event._serialize()
except AssertionError:
# Python 3.6
event.message = "Object of type 'Unserializable' is not JSON serializable"
assert serialized == event._serialize()


def test_handler_decorator(resource):
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/scheduler_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,6 @@ def test_cleanup_cloudwatch_events_boto_error(mock_logger, mock_boto3_session):

@patch("cloudformation_cli_python_lib.scheduler.datetime", autospec=True)
def test__min_to_cron(mock_datetime):
mock_datetime.now.return_value = datetime.fromisoformat("2019-01-01 01:01:01")
mock_datetime.now.return_value = datetime(2019, 1, 1, 1, 1, 1)
cron = CloudWatchScheduler._min_to_cron(1)
assert cron == "cron(03 01 01 01 ? 2019)"
2 changes: 1 addition & 1 deletion tests/lib/utils_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def default_assert(value):
with pytest.raises(TypeError):
json.dumps(value)

assert value == value.fromisoformat(roundtrip(value))
assert value.isoformat() == roundtrip(value)


# apply decorator multiple times to create different tests
Expand Down