Skip to content

Commit 7a817d2

Browse files
committed
create automated tests
1 parent f1dcebb commit 7a817d2

File tree

5 files changed

+48
-2
lines changed

5 files changed

+48
-2
lines changed

.github/workflows/run_tests.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Run Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- "*"
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- name: Set up Python 3.8
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: 3.8
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install -r requirements.txt
24+
pip install -r tests/requirements.txt
25+
- name: Lint with flake8
26+
run: |
27+
# stop the build if there are Python syntax errors or undefined names
28+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
29+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
30+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
31+
- name: Test with pytest
32+
run: |
33+
python -m pytest
34+
- name: Validate Cloudformation Tempates
35+
env:
36+
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
37+
ENVIRONMENT: dev
38+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
39+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
40+
run: |
41+
python -c "from deploy_cloudformation import validate_templates; validate_templates()"

deploy_cloudformation.py

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ def get_cloudformation_templates(reverse=False):
4444

4545
def validate_templates():
4646
cf_templates = get_cloudformation_templates()
47-
4847
for cf_template in cf_templates:
4948
logging.info('Validating CF template {}'.format(cf_template['filename']))
5049
cloudformation_client.validate_template(

requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
boto3==1.13.19
22
cryptography==2.9.2
3-
pandas==0.24.0
3+
pandas==1.1.2
4+
numpy==1.18.4
45
toolz==0.9.0
56
jinja2==2.11.2
67
click==7.1.2

tests/requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
flake8==3.8.3
2+
pytest==6.0.1

tests/test_dummy.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
def test_dummy():
3+
assert True

0 commit comments

Comments
 (0)