Files
T
Ed Morley ff8945c0c2 Tests: Make assertCapturedSuccess check stderr is empty again (#1087)
`assertCapturedSuccess` used to check that `stderr` was empty, until:
https://github.com/heroku/heroku-buildpack-python/commit/797652a75d69a1fece96a26bf4514fe9e9e1c020#diff-65c067a6f0a3aef292fb54ec21a1fe8cR98

Adding back the assertion exposes some new bugs, which I'll fix in
later PRs. In the meantime affected tests have been adjusted to use
a new `assertCapturedSuccessWithStdErr`.

The test harness output for the failing case has also been improved,
to ease debugging.

Closes @W-7918492@.

[skip changelog]
2020-10-01 17:29:13 +01:00

86 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Default Python Versions
# shellcheck source=bin/default_pythons
source "bin/default_pythons"
testAirflow() {
local env_dir="$(mktmpdir)"
echo 'yes' > "${env_dir}/SLUGIFY_USES_TEXT_UNIDECODE"
compile 'airflow' '' "${env_dir}"
assertCaptured "apache-airflow==1.10.2"
assertCapturedSuccess
}
testCollectstatic() {
compile "collectstatic"
assertCaptured "collectstatic"
}
testGEOS() {
local env_dir="$(mktmpdir)"
echo '1' > "${env_dir}/BUILD_WITH_GEO_LIBRARIES"
compile 'geos' '' "${env_dir}"
assertCaptured "geos"
assertCapturedSuccess
}
testGEOSDeprecation() {
local env_dir="$(mktmpdir)"
echo '1' > "${env_dir}/BUILD_WITH_GEO_LIBRARIES"
compile 'geos' '' "${env_dir}"
assertCaptured " ! The GDAL, GEOS and PROJ binaries and BUILD_WITH_GEO_LIBRARIES functonality are now deprecated.
! An alternative buildpack to enable GDAL, GEOS and PROJ use is available here - https://github.com/heroku/heroku-geo-buildpack"
assertCapturedSuccess
}
testNLTK() {
local env_dir="$(mktmpdir)"
# NOTE: This is a RuntimeWarning emitted by Python 3's runpy.py script
# which is what is used when you call `python -m <module>`. This is due to
# how nltk imports things. It's not actually an error, but it would probably
# be bad to silence in Production.
echo 'ignore::RuntimeWarning' > "${env_dir}/PYTHONWARNINGS"
compile 'nltk' '' "${env_dir}"
assertCaptured "[nltk_data] Downloading package city_database" "STD_ERR"
# Can't use `assertCapturedSuccess` since the NLTK downloader outputs all
# progress/status messages to stderr (W-8146040).
assertCapturedSuccessWithStdErr
}
testPsycopg2() {
compile "psycopg2"
assertCaptured "psycopg2"
assertCapturedSuccess
}
testPysqlite() {
compile "pysqlite"
assertCaptured "pysqlite"
assertCapturedSuccess
}
testSqliteInstall() {
compile "pythonDefault"
assertNotCaptured "Sqlite3 failed to install."
assertCapturedSuccess
}
testCffi() {
compile "cffi"
assertCaptured "cffi"
assertCapturedSuccess
}
testPylibmc() {
compile "pylibmc"
assertCaptured "pylibmc"
assertCapturedSuccess
}
pushd $(dirname 0) >/dev/null
popd >/dev/null
source $(pwd)/test/utils
source $(pwd)/test/shunit2