Skip to content

Commit 4fb4cb2

Browse files
author
lukpueh
authored
Merge pull request #890 from lukpueh/fix-coveralls
Fix publishing of coverage results to coveralls.io (+ misc test config updates)
2 parents bafebee + 098769b commit 4fb4cb2

File tree

5 files changed

+43
-29
lines changed

5 files changed

+43
-29
lines changed

.travis.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1+
dist: xenial
12
language: python
2-
dist: trusty
3-
sudo: false
43
cache: pip
5-
python: 3.6
64

7-
env:
8-
- TOXENV=py27
9-
- TOXENV=py34
10-
- TOXENV=py36
5+
matrix:
6+
include:
7+
- python: "2.7"
8+
env: TOXENV=py27
9+
- python: "3.4"
10+
env: TOXENV=py34
11+
- python: "3.5"
12+
env: TOXENV=py35
13+
- python: "3.6"
14+
env: TOXENV=py36
1115

12-
before_script:
13-
- pip install pylint bandit tox
16+
install:
17+
- pip install tox coveralls
1418

1519
script:
16-
- pylint tuf
17-
- bandit -r tuf
1820
- tox
1921

2022
after_success:
21-
- cd tests
22-
- coveralls
23-
- cd -
24-
25-
branches:
26-
only:
27-
- develop
28-
- pylint
29-
- bandit
23+
# Workaround to get coverage reports with relative paths.
24+
# FIXME: Consider refactoring the tests to not require the test aggregation
25+
# script being invoked from the `tests` directory, so that `.coverage` is
26+
# written to and .coveragrc can also reside in the project root directory, as
27+
# is the convention.
28+
- cp tests/.coverage .
29+
- coveralls --rcfile=tests/.coveragerc

ci-requirements.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
securesystemslib[crypto,pynacl]
22
six
33
iso8601
4-
coverage
5-
coveralls
6-
pylint
74
requests
5+
pylint
6+
bandit
7+
# Pin to versions supported by `coveralls` (see .travis.yml)
8+
# https://github.com/coveralls-clients/coveralls-python/releases/tag/1.8.1
9+
coverage<5.0

tests/.coveragerc

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
[run]
22
branch = True
33

4+
omit =
5+
# Command-line scripts.
6+
*/tuf/scripts/client.py
7+
*/tuf/scripts/repo.py
8+
*/tests/*
9+
*/site-packages/*
10+
411
[report]
512
exclude_lines =
613
pragma: no cover
714
def __str__
815
if __name__ == .__main__.:
9-
10-
omit =
11-
# Command-line scripts.
12-
*/tuf/scripts/client.py
13-
*/tuf/scripts/repo.py

tests/aggregate_tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
suite = unittest.TestLoader().loadTestsFromNames(test_modules_to_run)
9494
all_tests_passed = unittest.TextTestRunner(
9595
verbosity=1, buffer=True).run(suite).wasSuccessful()
96+
9697
if not all_tests_passed:
9798
sys.exit(1)
9899

tox.ini

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,24 @@
55

66
[tox]
77
envlist = py27, py34, py35, py36
8+
skipsdist = true
89

910
[testenv]
11+
# TODO: Consider refactoring the tests to not require the aggregation script
12+
# being invoked from the `tests` directory. This seems to be the convention and
13+
# would make use of other testing tools such as coverage/coveralls easier.
1014
changedir = tests
1115

1216
commands =
13-
coverage run --source tuf aggregate_tests.py
17+
pylint {toxinidir}/tuf
18+
bandit -r {toxinidir}/tuf
19+
coverage run aggregate_tests.py
1420
coverage report -m --fail-under 97
1521

1622
deps =
1723
-r{toxinidir}/ci-requirements.txt
24+
# Install TUF in editable mode, instead of tox default virtual environment
25+
# installation (see `skipsdist`), to get relative paths in coverage reports
26+
--editable {toxinidir}
1827

1928
install_command = pip install --pre {opts} {packages}

0 commit comments

Comments
 (0)