Skip to content

Commit 0448d3b

Browse files
authored
Public CI runs (#68)
1 parent 52ea532 commit 0448d3b

File tree

6 files changed

+33
-5
lines changed

6 files changed

+33
-5
lines changed

.travis.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
language: python
2+
dist: bionic
3+
sudo: false
4+
cache: pip
5+
before_install:
6+
- >
7+
pip install --upgrade pip mypy 'attrs==19.2.0'
8+
-r https://raw.githubusercontent.com/aws-cloudformation/aws-cloudformation-rpdk/master/requirements.txt
9+
install:
10+
- pip install . src/
11+
env:
12+
global:
13+
- AWS_DEFAULT_REGION="us-east-1"
14+
script:
15+
- pre-commit run --all-files
16+
jobs:
17+
include:
18+
- python: "3.6"
19+
- python: "3.7"
20+
- python: "3.8"

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ The CloudFormation Resource Provider Development Kit (RPDK) allows you to author
88

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

11+
[![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)
12+
1113
Installation
1214
------------
1315

python/rpdk/python/codegen.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import shutil
33
import zipfile
44
from pathlib import PurePosixPath
5-
from subprocess import CalledProcessError, run as subprocess_run # nosec
5+
from subprocess import PIPE, CalledProcessError, run as subprocess_run # nosec
66
from tempfile import TemporaryFile
77

88
import docker
@@ -276,7 +276,7 @@ def _pip_build(cls, base_path):
276276
LOG.warning("Starting pip build.")
277277
try:
278278
completed_proc = subprocess_run( # nosec
279-
command, capture_output=True, cwd=base_path, check=True
279+
command, stdout=PIPE, stderr=PIPE, cwd=base_path, check=True
280280
)
281281
except (FileNotFoundError, CalledProcessError) as e:
282282
raise DownstreamError("pip build failed") from e

tests/lib/resource_test.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,13 @@ class Unserializable:
255255
HandlerErrorCode.InternalFailure,
256256
"Object of type Unserializable is not JSON serializable",
257257
)
258-
assert serialized == event._serialize()
258+
try:
259+
# Python 3.7/3.8
260+
assert serialized == event._serialize()
261+
except AssertionError:
262+
# Python 3.6
263+
event.message = "Object of type 'Unserializable' is not JSON serializable"
264+
assert serialized == event._serialize()
259265

260266

261267
def test_handler_decorator(resource):

tests/lib/scheduler_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,6 @@ def test_cleanup_cloudwatch_events_boto_error(mock_logger, mock_boto3_session):
129129

130130
@patch("cloudformation_cli_python_lib.scheduler.datetime", autospec=True)
131131
def test__min_to_cron(mock_datetime):
132-
mock_datetime.now.return_value = datetime.fromisoformat("2019-01-01 01:01:01")
132+
mock_datetime.now.return_value = datetime(2019, 1, 1, 1, 1, 1)
133133
cron = CloudWatchScheduler._min_to_cron(1)
134134
assert cron == "cron(03 01 01 01 ? 2019)"

tests/lib/utils_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def default_assert(value):
1515
with pytest.raises(TypeError):
1616
json.dumps(value)
1717

18-
assert value == value.fromisoformat(roundtrip(value))
18+
assert value.isoformat() == roundtrip(value)
1919

2020

2121
# apply decorator multiple times to create different tests

0 commit comments

Comments
 (0)