Skip to content

Commit 31ae40e

Browse files
chore: Add dedicated code coverage tox environment
1 parent 05cd225 commit 31ae40e

File tree

4 files changed

+30
-2
lines changed

4 files changed

+30
-2
lines changed

buildspec.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ batch:
1313
buildspec: codebuild/python_37.yml
1414
- identifier: python_38
1515
buildspec: codebuild/python_38.yml
16+
17+
- identifier: code_coverage
18+
buildspec: codebuild/coverage.yml

codebuild/coverage.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 0.2
2+
3+
env:
4+
variables:
5+
TOXENV: "coverage"
6+
AWS_ENCRYPTION_SDK_PYTHON_INTEGRATION_TEST_AWS_KMS_KEY_ID: >-
7+
arn:aws:kms:us-west-2:658956600833:key/b3537ef1-d8dc-4780-9f5a-55776cbb2f7f
8+
9+
phases:
10+
install:
11+
runtime-versions:
12+
python: latest
13+
build:
14+
commands:
15+
- pip install tox
16+
- tox

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ branch = True
99

1010
[coverage:report]
1111
show_missing = True
12+
fail_under = 70
1213

1314
[mypy]
1415
ignore_missing_imports = True

tox.ini

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ envlist =
2929
# test-release :: Builds dist files and uploads to testpypi pypirc profile.
3030
# release :: Builds dist files and uploads to pypi pypirc profile.
3131

32+
# Reporting environments:
33+
#
34+
# coverage :: Runs code coverage, failing the build if coverage is below the configured threshold
35+
3236
[testenv]
3337
passenv =
3438
# Identifies AWS KMS key id to use in integration tests
@@ -49,10 +53,14 @@ deps =
4953
pytest-cov
5054
pytest-mock
5155
commands =
52-
local: pytest --cov aws_encryption_sdk_cli -m local -l test/ {posargs}
53-
integ: pytest --cov aws_encryption_sdk_cli -m integ -l test/ {posargs}
56+
local: pytest -m local -l test/ {posargs}
57+
integ: pytest -m integ -l test/ {posargs}
5458
all: pytest --cov aws_encryption_sdk_cli -l test/ {posargs}
5559

60+
# Run code coverage on the unit tests
61+
[testenv:coverage]
62+
commands = pytest --cov aws_encryption_sdk test/
63+
5664
# mypy
5765
[testenv:mypy-coverage]
5866
commands =

0 commit comments

Comments
 (0)