Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add coverage for python #1483

Merged
merged 7 commits into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[run]
branch = true

source =
datumaro/datumaro/
cvat/apps/
utils/cli/

omit =
datumaro/datumaro/__main__.py
datumaro/datumaro/version.py
cvat/settings/*
*/tests/*
*/test_*
*/_test_*
*/migrations/*

[report]
# Regexes for lines to exclude from consideration
exclude_lines =
# Have to re-enable the standard pragma
pragma: no cover

# Don't complain about missing debug-only code:
def __repr__
if\s+[\w\.()]+\.isEnabledFor\(log\.DEBUG\):

# Don't complain if tests don't hit defensive assertion code:
raise AssertionError
raise NotImplementedError

# Don't complain if non-runnable code isn't run:
if 0:
if __name__ == .__main__.:

# don't fail on the code that can be found
ignore_errors = true

skip_empty = true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ docker-compose.override.yml
__pycache__
*.pyc
._*
.coverage

# Ignore development npm files
node_modules
Expand Down
18 changes: 14 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,21 @@ python:
services:
- docker

env:
- CONTAINER_COVERAGE_DATA_DIR="/coverage_data"
HOST_COVERAGE_DATA_DIR="${TRAVIS_BUILD_DIR}/coverage_data"

install:
- gem install coveralls-lcov
- pip install coveralls

before_script:
- docker-compose -f docker-compose.yml -f docker-compose.ci.yml build
- mkdir -m a=rwx -p ${HOST_COVERAGE_DATA_DIR}

script:
- docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'python3 manage.py test cvat/apps utils/cli'
- docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'python3 manage.py test --pattern="_tests.py" cvat/apps/dataset_manager'
- docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'python3 manage.py test datumaro/'
- docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'cd cvat-data && npm install && cd ../cvat-core && npm install && npm run test && npm run coveralls'
- docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'coverage run -a manage.py test cvat/apps utils/cli && coverage run -a --source cvat/apps/ manage.py test --pattern="_tests.py" cvat/apps/dataset_manager && mv .coverage ${CONTAINER_COVERAGE_DATA_DIR}'
- docker-compose -f docker-compose.yml -f docker-compose.ci.yml run cvat_ci /bin/bash -c 'cd cvat-data && npm install && cd ../cvat-core && npm install && npm run test && mv ./reports/coverage/lcov.info ${CONTAINER_COVERAGE_DATA_DIR}'

after_success:
- coveralls-lcov -v -n lcov.info > coverage.json && coveralls --merge=coverage.json
1 change: 1 addition & 0 deletions cvat/requirements/testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ fakeredis==1.1.0
# Fix dependencies for fakeredis 1.1.0
# Pip will not reinstall six package if it is installed already
six==1.12.0
coveralls
3 changes: 3 additions & 0 deletions docker-compose.ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ services:
TRAVIS_JOB_ID:
TRAVIS_BRANCH:
TRAVIS_PULL_REQUEST:
CONTAINER_COVERAGE_DATA_DIR:
volumes:
- ${HOST_COVERAGE_DATA_DIR}:${CONTAINER_COVERAGE_DATA_DIR}