From 989de484d7338edf951e1cb17bad70eb00add8d8 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Tue, 6 Mar 2018 08:50:11 -0500 Subject: [PATCH] better test script Signed-off-by: Kenneth Reitz --- run-tests.sh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/run-tests.sh b/run-tests.sh index 511e2252..a0771d1b 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -33,17 +33,32 @@ else diskutil erasevolume HFS+ 'RAMDisk' $(hdiutil attach -nomount ram://8388608) fi - RAM_DISK="/Volumes/RAMDisk" export RAM_DISK - pipenv install --dev + if [[ ! -d "$RAM_DISK/.venv" ]]; then + echo "Creating a new venv on RAM Disk…" + python3 -m venv "$RAM_DISK/.venv" + fi + + echo "Instaling Pipenv…" + "$RAM_DISK/.venv/bin/pip" install -e "$(pwd)" --upgrade-strategy=only-if-needed + + # If the lockfile hasn't changed, skip installs. + if [[ $(openssl dgst -sha256 Pipfile.lock) != $(cat "$RAM_DISK/.venv/Pipfile.lock.sha256") ]]; then + "$RAM_DISK/.venv/bin/pipenv" install --dev + + # Hash the lockfile, to skip intalls next time. + openssl dgst -sha256 Pipfile.lock > $RAM_DISK/.venv/Pipfile.lock.sha256" + fi + + fi if [[ "$TAP_OUTPUT" ]]; then echo "$ pipenv run time pytest -v -n auto tests -m \"$TEST_SUITE\" --tap-stream | tee report.tap" - pipenv run time pytest -v -n auto tests -m "$TEST_SUITE" --tap-stream | tee report.tap + "$RAM_DISK/.venv/bin/pipenv" run time pytest -v -n auto tests -m "$TEST_SUITE" --tap-stream | tee report.tap else echo "$ pipenv run time pytest -v -n auto tests -m \"$TEST_SUITE\"" - pipenv run time pytest -v -n auto tests -m "$TEST_SUITE" + "$RAM_DISK/.venv/bin/pipenv" run time pytest -v -n auto tests -m "$TEST_SUITE" fi \ No newline at end of file