From f6dd7b51485636c5b8ada0cdabf41578dcbf8452 Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sun, 11 Mar 2018 10:36:16 -0400 Subject: [PATCH] test suite downgrade Signed-off-by: Kenneth Reitz --- run-tests.sh | 68 +++++++--------------------------------------------- 1 file changed, 8 insertions(+), 60 deletions(-) diff --git a/run-tests.sh b/run-tests.sh index ad0de8b9..88976069 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -17,91 +17,39 @@ fi if [[ ! -z "$CI" ]]; then echo "Running in a CI environment…" - echo "Using RAM disk…" - RAM_DISK="/opt/ramdisk" - export RAM_DISK - # Use tap output for tests. TAP_OUTPUT="1" export TAP_OUTPUT - # Check for a checksum of the lockfile on the RAM Disk. - if [[ -f "$RAM_DISK/Pipfile.lock.sha256-nevermind" ]]; then + echo "Installing Pipenv…" - # If it's not the same, re-install. - if [[ $(openssl dgst -sha256 Pipfile.lock) != $(cat "$RAM_DISK/Pipfile.lock.sha256") ]]; then - INSTALL_PIPENV=1 - echo "Installing Pipenv…" - fi - else - # If the checksum doesn't exist, re-install. - INSTALL_PIPENV=1 - fi - - # Install Pipenv… - if [[ "$INSTALL_PIPENV" ]]; then - pip install -e "$(pwd)" --upgrade - pipenv install --deploy --system --dev - - openssl dgst -sha256 Pipfile.lock > "$RAM_DISK/Pipfile.lock.sha256" - fi + pip install -e "$(pwd)" --upgrade + pipenv install --deploy --system --dev # Otherwise, we're on a development machine. else # First, try MacOS… if [[ $(python -c "import sys; print(sys.platform)") == "darwin" ]]; then - echo "Using RAM disk (assuming MacOS)…" - - RAM_DISK="/Volumes/RAMDisk" - export RAM_DISK echo "Clearing Caches…" rm -fr ~/Library/Caches/pip rm -fr ~/Libary/Caches/pipenv - if [[ ! -d "$RAM_DISK" ]]; then - echo "Creating RAM Disk ($RAM_DISK)…" - diskutil erasevolume HFS+ 'RAMDisk' $(hdiutil attach -nomount ram://8388608) - fi - # Otherwise, assume Linux… else - echo "Using RAM disk (assuming Linux)…" - - RAM_DISK="/media/ramdisk" - export RAM_DISK - echo "Clearing Caches…" rm -fr ~/.cache/pip rm -fr ~/.cache/pipenv - - if [[ ! -d "$RAM_DISK" ]]; then - echo "Creating RAM Disk ($RAM_DISK)…" - sudo mkdir -p "$RAM_DISK" - sudo mount -t tmpfs -o size=4096M tmpfs "$RAM_DISK" - fi - fi - - # If the virtualenv doesn't exist, create it. - if [[ ! -d "$RAM_DISK/.venv" ]]; then - echo "Creating a new venv on RAM Disk…" - virtualenv "$RAM_DISK/.venv" fi # If the lockfile hasn't changed, skip installs. - if [[ $(openssl dgst -sha256 Pipfile.lock) != $(cat "$RAM_DISK/.venv/Pipfile.lock.sha256") ]]; then - echo "Instaling Pipenv…" - "$RAM_DISK/.venv/bin/pip" install -e "$(pwd)" --upgrade-strategy=only-if-needed - - echo "Installing dependencies…" - "$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 + echo "Instaling Pipenv…" + pip install -e "$(pwd)" --upgrade-strategy=only-if-needed + echo "Installing dependencies…" + pipenv install --dev fi # Use tap output if in a CI environment, otherwise just run the tests. @@ -110,5 +58,5 @@ if [[ "$TAP_OUTPUT" ]]; then 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\"" - "$RAM_DISK/.venv/bin/pipenv" run time pytest -v -n auto tests -m "$TEST_SUITE" + pipenv run time pytest -v -n auto tests -m "$TEST_SUITE" fi \ No newline at end of file