all kinds of awesome tests

This commit is contained in:
Kenneth Reitz
2012-03-23 19:52:03 -04:00
parent 979491a631
commit c196347e58
19 changed files with 493 additions and 2 deletions
+13 -2
View File
@@ -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
+61
View File
@@ -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 ########################################