From 86952dd3edf4ca45f8df7440cb8b6d31d9e415d7 Mon Sep 17 00:00:00 2001 From: Tim Burke Date: Tue, 15 Oct 2019 15:06:35 -0700 Subject: [PATCH] tests: Stop invoking python just to get the real source directory While we're at it, stop checking for a seven-year-old version of nose -- we already list a newer version in test-requirements.txt anyway. Change-Id: I97beace3094f11286730b99653dc1e8f699c5aec --- .alltests | 2 +- .functests | 2 +- .probetests | 2 +- .unittests | 12 ++---------- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/.alltests b/.alltests index ac30d57386..75ccf9a527 100755 --- a/.alltests +++ b/.alltests @@ -2,7 +2,7 @@ set -e -TOP_DIR=$(python -c "import os; print os.path.dirname(os.path.realpath('$0'))") +TOP_DIR=$(dirname $(realpath "$0")) echo "==== Unit tests ====" resetswift diff --git a/.functests b/.functests index cd3c311298..82638240b8 100755 --- a/.functests +++ b/.functests @@ -3,7 +3,7 @@ # How-To debug functional tests: # SWIFT_TEST_IN_PROCESS=1 tox -e func -- --pdb test.functional.tests.TestFile.testCopy -SRC_DIR=$(python -c "import os; print(os.path.dirname(os.path.realpath('$0')))") +SRC_DIR=$(dirname $(realpath "$0")) cd ${SRC_DIR} > /dev/null export TESTS_DIR=${SRC_DIR}/test/functional diff --git a/.probetests b/.probetests index 386847f26b..4c8d4dd36a 100755 --- a/.probetests +++ b/.probetests @@ -1,6 +1,6 @@ #!/bin/bash -SRC_DIR=$(python -c "import os; print(os.path.dirname(os.path.realpath('$0')))") +SRC_DIR=$(dirname $(realpath "$0")) cd ${SRC_DIR}/test/probe nosetests --exe $@ diff --git a/.unittests b/.unittests index 7faed77dce..aecedf813e 100755 --- a/.unittests +++ b/.unittests @@ -1,17 +1,9 @@ #!/bin/bash -TOP_DIR=$(python -c "import os; print(os.path.dirname(os.path.realpath('$0')))") +TOP_DIR=$(dirname $(realpath "$0")) -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 - # Having the HTML reports is REALLY useful for achieving 100% branch - # coverage. - cover_branches="--cover-branches --cover-html --cover-html-dir=$TOP_DIR/cover" -fi cd $TOP_DIR/test/unit -nosetests --exe --with-coverage --cover-package swift --cover-erase $cover_branches $@ +nosetests --exe --with-coverage --cover-package swift --cover-erase --cover-branches --cover-html --cover-html-dir="$TOP_DIR"/cover $@ rvalue=$? rm -f .coverage cd -