mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 23:10:16 +00:00
all kinds of awesome tests
This commit is contained in:
+13
-2
@@ -3,9 +3,20 @@
|
||||
|
||||
BUILD_DIR=$1
|
||||
|
||||
# Exit early if app is clearly not Python.
|
||||
if [ ! -f $BUILD_DIR/requirements.txt ] && [ ! -f $BUILD_DIR/setup.py ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 'Python/Django' if there is a [mysite]/settings.py file present; otherwise 'Python'
|
||||
ls $BUILD_DIR/**/settings.py &> /dev/null && (grep -Fiq "django" requirements.txt) && echo Python/Django || echo Python
|
||||
# If only `setup.py`, assume that the app is not Django.
|
||||
if [ ! -f $BUILD_DIR/requirements.txt ]; then
|
||||
echo Python
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# `Python/Django` if `**/settings.py` is present and `django` exists in
|
||||
# `requirements.txt`.
|
||||
#
|
||||
# Otherwise, `Python`.
|
||||
|
||||
ls $BUILD_DIR/**/settings.py &> /dev/null && (grep -Fiq "django" $BUILD_DIR/requirements.txt) && echo Python/Django || echo Python
|
||||
|
||||
@@ -8,6 +8,67 @@
|
||||
# run the tests.
|
||||
#
|
||||
|
||||
testDetectWithReqs() {
|
||||
detect "simple-requirements"
|
||||
assertCapturedEquals "Python"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testDetectWithEmptyReqs() {
|
||||
detect "empty-requirements"
|
||||
assertCapturedEquals "Python"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testDetectDjango14() {
|
||||
detect "django-1.4-skeleton"
|
||||
assertCapturedEquals "Python/Django"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testDetectDjango13() {
|
||||
detect "django-1.3-skeleton"
|
||||
assertCapturedEquals "Python/Django"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testDetectNotDjangoWithSettings() {
|
||||
detect "not-django"
|
||||
assertCapturedEquals "Python"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testDetectWithSetupPy() {
|
||||
detect "distutils"
|
||||
assertCapturedEquals "Python"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testDetectWithSetupRequires() {
|
||||
detect "no-requirements"
|
||||
assertCapturedEquals "Python"
|
||||
assertCapturedSuccess
|
||||
}
|
||||
|
||||
testDetectNotPython() {
|
||||
detect "not-python"
|
||||
assertNotCaptured "Python"
|
||||
assertNoAppDetected
|
||||
}
|
||||
|
||||
# testPackageJsonWithVersion() {
|
||||
# compile "package-json-version"
|
||||
# assertCaptured "Using Node.js version: 0.6.11"
|
||||
# assertCaptured "Using npm version: 1.1.9"
|
||||
# assertCapturedSuccess
|
||||
# }
|
||||
|
||||
# testPackageJsonWithoutVersion() {
|
||||
# compile "package-json-noversion"
|
||||
# assertCaptured "Using Node.js version: 0.4.7"
|
||||
# assertCaptured "Using npm version: 1.0.106"
|
||||
# assertCapturedSuccess
|
||||
# }
|
||||
|
||||
## utils ########################################
|
||||
|
||||
|
||||
Reference in New Issue
Block a user