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
changes/26/688826/1
Tim Burke 2019-10-15 15:06:35 -07:00
parent 294472464a
commit 86952dd3ed
4 changed files with 5 additions and 13 deletions

View File

@ -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

View File

@ -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

View File

@ -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 $@

View File

@ -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 -