Skip to content

Commit

Permalink
Merge 157167e into 65e5ee1
Browse files Browse the repository at this point in the history
  • Loading branch information
lukpueh committed Jun 26, 2019
2 parents 65e5ee1 + 157167e commit 6d88a26
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 24 deletions.
40 changes: 20 additions & 20 deletions .travis.yml
@@ -1,29 +1,29 @@
dist: xenial
language: python
dist: trusty
sudo: false
cache: pip
python: 3.6

env:
- TOXENV=py27
- TOXENV=py34
- TOXENV=py36
matrix:
include:
- python: "2.7"
env: TOXENV=py27
- python: "3.4"
env: TOXENV=py34
- python: "3.5"
env: TOXENV=py35
- python: "3.6"
env: TOXENV=py36

before_script:
- pip install pylint bandit tox
install:
- pip install tox coveralls

script:
- pylint tuf
- bandit -r tuf
- tox

after_success:
- cd tests
- coveralls
- cd -

branches:
only:
- develop
- pylint
- bandit
# Workaround to get coverage reports with relative paths.
# FIXME: Consider refactoring the tests to not require the test aggregation
# script being invoked from the `tests` directory, so that `.coverage` is
# written to and .coveragrc can also reside in the project root directory, as
# as the convention.
- cp tests/.coverage .
- coveralls --rcfile=tests/.coveragerc
8 changes: 5 additions & 3 deletions ci-requirements.txt
@@ -1,7 +1,9 @@
securesystemslib[crypto,pynacl]
six
iso8601
coverage
coveralls
pylint
requests
pylint
bandit
# Pin to versions supported by `coveralls` (see .travis.yml)
# https://github.com/coveralls-clients/coveralls-python/releases/tag/1.8.1
coverage<5.0
2 changes: 2 additions & 0 deletions tests/.coveragerc
Expand Up @@ -11,3 +11,5 @@ omit =
# Command-line scripts.
*/tuf/scripts/client.py
*/tuf/scripts/repo.py
*/tests/*
*/site-packages/*
13 changes: 13 additions & 0 deletions tests/aggregate_tests.py
Expand Up @@ -34,6 +34,7 @@
from __future__ import division
from __future__ import unicode_literals

import os
import sys
import unittest
import glob
Expand Down Expand Up @@ -90,9 +91,21 @@
random.shuffle(test_modules_to_run)

if __name__ == '__main__':
# NOTE: Temporary workaround to ensure that `tuf` code from the sibling `tuf`
# directory is prioritized over `tuf` code installed to some system or
# virtualenv site-packages directory, which in turn is required for
# coverage/coveralls to function correctly.
# FIXME: Consider refactoring the tests to not require this the aggregation
# script being invoked from the `tests` directory. This seems to be the
# convention and would make use of other testing tools such as
# coverage/coveralls easier.
sys.path.insert(0,
os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

suite = unittest.TestLoader().loadTestsFromNames(test_modules_to_run)
all_tests_passed = unittest.TextTestRunner(
verbosity=1, buffer=True).run(suite).wasSuccessful()

if not all_tests_passed:
sys.exit(1)

Expand Down
4 changes: 3 additions & 1 deletion tox.ini
Expand Up @@ -10,7 +10,9 @@ envlist = py27, py34, py35, py36
changedir = tests

commands =
coverage run --source tuf aggregate_tests.py
pylint {toxinidir}/tuf
bandit -r {toxinidir}/tuf
coverage run aggregate_tests.py
coverage report -m --fail-under 97

deps =
Expand Down

0 comments on commit 6d88a26

Please sign in to comment.