2021-04-03 18:18:50 -04:00
|
|
|
# This script is sourced by CI scripts to launch httpbin.
|
|
|
|
#
|
|
|
|
# Do not run it directly.
|
|
|
|
|
|
|
|
httpbin_launch() {
|
|
|
|
echo 'Launching httpbin...'
|
|
|
|
|
|
|
|
case "$(uname -s)" in
|
|
|
|
Linux)
|
|
|
|
dist_codename=$(lsb_release --codename --short)
|
|
|
|
;;
|
2021-04-03 18:29:27 -04:00
|
|
|
|
|
|
|
Darwin)
|
|
|
|
dist_codename='macOS'
|
|
|
|
;;
|
2021-04-03 18:18:50 -04:00
|
|
|
esac
|
|
|
|
|
|
|
|
case "$dist_codename" in
|
|
|
|
trusty)
|
2021-04-03 18:29:27 -04:00
|
|
|
# Current decorator (>= 5) is incompatible with Python 2 which we
|
|
|
|
# still use in some builds, so explicitly use a version which
|
|
|
|
# is known to work. Just specifying "decorator==4.4.2" doesn't work
|
|
|
|
# neither for some reason ("no matching distribution found"), so
|
|
|
|
# use an explicit URL.
|
2021-04-03 18:18:50 -04:00
|
|
|
pip_decorator_arg='https://files.pythonhosted.org/packages/ed/1b/72a1821152d07cf1d8b6fce298aeb06a7eb90f4d6d41acec9861e7cc6df0/decorator-4.4.2-py2.py3-none-any.whl'
|
2021-04-03 18:29:27 -04:00
|
|
|
|
|
|
|
# We need to disable SSL certificate checking under Trusty because
|
|
|
|
# Python version there is too old to support SNI.
|
2021-04-03 18:18:50 -04:00
|
|
|
pip_options='--trusted-host files.pythonhosted.org'
|
|
|
|
;;
|
|
|
|
|
2021-04-03 18:29:27 -04:00
|
|
|
macOS)
|
2021-04-03 18:18:50 -04:00
|
|
|
pip_decorator_arg='decorator==4.4.2'
|
|
|
|
;;
|
2021-04-03 18:29:27 -04:00
|
|
|
|
|
|
|
*)
|
|
|
|
# Elsewhere just use Python 3.
|
|
|
|
PY3=3
|
2021-04-03 19:29:29 -04:00
|
|
|
|
|
|
|
# Running pip install fails with weird errors out of the box when
|
|
|
|
# using old pip version because it attempts to use python rather
|
|
|
|
# than python3, so upgrade it to fix this.
|
2021-04-03 19:34:45 -04:00
|
|
|
#
|
|
|
|
# However don't upgrade to a version which is too new because then
|
|
|
|
# it may not support Python version that we actually have.
|
|
|
|
python3 -m pip install --upgrade pip==20
|
2021-04-03 18:29:27 -04:00
|
|
|
;;
|
2021-04-03 18:18:50 -04:00
|
|
|
esac
|
|
|
|
|
2021-04-03 18:29:27 -04:00
|
|
|
python$PY3 -m pip install $pip_decorator_arg httpbin --user $pip_options
|
|
|
|
python$PY3 -m httpbin.core 2>&1 >httpbin.log &
|
2021-04-03 18:18:50 -04:00
|
|
|
WX_TEST_WEBREQUEST_URL="http://localhost:5000"
|
|
|
|
|
|
|
|
export WX_TEST_WEBREQUEST_URL
|
|
|
|
}
|
|
|
|
|
|
|
|
httpbin_show_log() {
|
|
|
|
echo '*** Tests failed, contents of httpbin.log follows: ***'
|
|
|
|
echo '-----------------------------------------------------------'
|
|
|
|
cat httpbin.log
|
|
|
|
echo '-----------------------------------------------------------'
|
|
|
|
}
|