diff --git a/.unittests b/.unittests index ac7dba916b..4b33e00558 100755 --- a/.unittests +++ b/.unittests @@ -1,7 +1,13 @@ #!/bin/bash +python -c 'from distutils.version import LooseVersion as Ver; import nose, sys; sys.exit(0 if Ver(nose.__version__) >= Ver("1.2.0") else 1)' +if [ $? != 0 ]; then + cover_branches="" +else + cover_branches="--cover-branches" +fi cd $(dirname $0)/test/unit -nosetests --exe --with-coverage --cover-package swift. --cover-erase $@ +nosetests --exe --with-coverage --cover-package swift. --cover-erase $cover_branches $@ rvalue=$? rm -f .coverage cd - diff --git a/tox.ini b/tox.ini index c093e0d049..1f37566e30 100644 --- a/tox.ini +++ b/tox.ini @@ -9,6 +9,8 @@ setenv = VIRTUAL_ENV={envdir} NOSE_OPENSTACK_YELLOW=0.025 NOSE_OPENSTACK_SHOW_ELAPSED=1 NOSE_OPENSTACK_STDOUT=1 + NOSE_WITH_COVERAGE=1 + NOSE_COVER_BRANCHES=1 deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt @@ -22,9 +24,6 @@ commands = flake8 flake8 --filename=swift* bin -[testenv:cover] -setenv = NOSE_WITH_COVERAGE=1 - [testenv:venv] commands = {posargs}