mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
test suite downgrade
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
This commit is contained in:
+8
-60
@@ -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
|
||||
Reference in New Issue
Block a user