Skip to content

Commit 7f8fece

Browse files
committed
Added tests script
1 parent 26e04cd commit 7f8fece

4 files changed

Lines changed: 39 additions & 0 deletions

File tree

.coveragerc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[run]
2+
branch = True
3+
source = amazon_paapi
4+
omit = **/sdk/**
5+
6+
[report]
7+
fail_under = 80
8+
skip_covered = true
9+
skip_empty = true
10+
11+
[html]
12+
directory = coverage_html_report
13+
skip_covered = false

.githooks/pre-push

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ source "${ROOT_DIR}/scripts/helpers"
77
./scripts/check_black
88
./scripts/check_flake8
99
./scripts/check_pylint
10+
./scripts/run_tests
1011

1112
header "Proceeding with push"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.DS_Store
44
secrets.py
55
test.py
6+
coverage_html_report
67

78

89
# Byte-compiled / optimized / DLL files

scripts/run_tests

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#! /bin/bash
2+
3+
ROOT_DIR="$(git rev-parse --show-toplevel)"
4+
source "${ROOT_DIR}/scripts/helpers"
5+
6+
header "Running tests"
7+
8+
if [ -n "$(check_if_installed docker)" ]; then
9+
docker run -v "${PWD}:/code" sergioteula/pytools bash -c \
10+
"coverage run -m unittest && coverage xml && coverage html && coverage report"
11+
elif [ -n "$(check_if_installed coverage)" ]; then
12+
coverage run -m unittest && coverage xml && coverage html && coverage report
13+
else
14+
error "coverage is not installed"
15+
exit 1
16+
fi
17+
18+
EXIT_CODE="$?"
19+
if [ "$EXIT_CODE" = "0" ]; then
20+
success "Tests passed"
21+
else
22+
error "Tests failed"
23+
exit 1
24+
fi

0 commit comments

Comments
 (0)