mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-17 07:53:42 -05:00
Add unittest
This commit is contained in:
45
test/installer.bats
Normal file
45
test/installer.bats
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
load test_helper
|
||||
|
||||
@test "installs pyenv-virtualenv into PREFIX" {
|
||||
cd "$TMP"
|
||||
PREFIX="${PWD}/usr" run "${BATS_TEST_DIRNAME}/../install.sh"
|
||||
assert_success ""
|
||||
|
||||
cd usr
|
||||
|
||||
assert [ -x bin/pyenv-sh-activate ]
|
||||
assert [ -x bin/pyenv-sh-deactivate ]
|
||||
assert [ -x bin/pyenv-virtualenv ]
|
||||
assert [ -x bin/pyenv-virtualenv-prefix ]
|
||||
assert [ -x bin/pyenv-virtualenvs ]
|
||||
}
|
||||
|
||||
@test "overwrites old installation" {
|
||||
cd "$TMP"
|
||||
mkdir -p bin
|
||||
touch bin/pyenv-virtualenv
|
||||
|
||||
PREFIX="$PWD" run "${BATS_TEST_DIRNAME}/../install.sh"
|
||||
assert_success ""
|
||||
|
||||
assert [ -x bin/pyenv-virtualenv ]
|
||||
run grep "virtualenv" bin/pyenv-virtualenv
|
||||
assert_success
|
||||
}
|
||||
|
||||
@test "unrelated files are untouched" {
|
||||
cd "$TMP"
|
||||
mkdir -p bin share/bananas
|
||||
chmod g-w bin
|
||||
touch bin/bananas
|
||||
|
||||
PREFIX="$PWD" run "${BATS_TEST_DIRNAME}/../install.sh"
|
||||
assert_success ""
|
||||
|
||||
assert [ -e bin/bananas ]
|
||||
|
||||
run ls -ld bin
|
||||
assert_equal "r-x" "${output:4:3}"
|
||||
}
|
||||
Reference in New Issue
Block a user