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

[coverage] Add coverage tests with avocado and replace nosetests #3668

Closed
wants to merge 1 commit into from
Closed
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
12 changes: 12 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,18 @@ pylint_task:
setup_script: *tox-lint-setup
pylint_script: tox -e pylint

coverage_task:
alias: "unit_coverage_test"
name: "unit and coverage test"
container:
image: "python:latest"
setup_script: *tox-lint-setup
coverage_script: tox -e coverage
prep_artefacts_script: |
ls -d ./cover 2> /dev/null | xargs tar cf coverage-html.tar
packages_artifacts:
path: "coverage-html.tar"

# Run a check on newer upstream python versions to check for possible
# breaks/changes in common modules. This is not meant to check any of the actual
# collections or archive integrity.
Expand Down
4 changes: 4 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[run]
concurrency = multiprocessing
source = sos
parallel = true
17 changes: 13 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ setenv =
PYTHONPATH = {toxinidir}/tests:{toxinidir}
avocado_cmd =
avocado run -p TESTLOCAL=true --max-parallel-tasks=1
unit_tests =
{toxinidir}/tests/unittests
stage_tests =
{toxinidir}/tests/cleaner_tests \
{toxinidir}/tests/collect_tests \
Expand All @@ -33,7 +35,7 @@ commands = pylint -v --rcfile={toxinidir}/pylintrc {posargs:{[testenv]py_files}}
[testenv:unit_tests]
basepython = python3
commands =
avocado run tests/unittests
avocado run {posargs:{[testenv]unit_tests}}

[testenv:stageone_tests]
basepython = python3
Expand All @@ -51,10 +53,17 @@ basepython = python3
commands =
{[testenv]avocado_cmd} -t foreman {posargs:{[testenv]foreman_tests}}

[testenv:nosetests]
[testenv:coverage]
basepython = python3
setenv =
{[testenv]setenv}
COVERAGE_RUN = "true"
deps =
{[testenv]deps}
nose3
coverage
commands =
nosetests -v --with-coverage --cover-package=sos tests/unittests --cover-html
coverage erase
coverage run -m avocado run {posargs:{[testenv]unit_tests}}
coverage combine
coverage html -d cover
coverage report
Loading