HEX
Server: Apache/2.4.65 (Ubuntu)
System: Linux ielts-store-v2 6.8.0-1036-gcp #38~22.04.1-Ubuntu SMP Thu Aug 14 01:19:18 UTC 2025 x86_64
User: root (0)
PHP: 7.2.34-54+ubuntu20.04.1+deb.sury.org+1
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,
Upload Files
File: //snap/google-cloud-cli/396/platform/gsutil/third_party/httplib2/script/test
#!/bin/bash
set -eux
# By default, run tests with pytest-forked plugin,
# disable in terminal for debugging, you may add --forked
flag_forked="--forked"
if [[ -z "${CI:-}" ]] && [[ -t 1 ]] ; then
	flag_forked=""
fi
test_flags=(
	$@
	$flag_forked
	tests/
)

main() {
	cd "$( dirname "${BASH_SOURCE[0]}" )/.."
	if [[ -n "${CI:-}" ]] ; then
		case "${test_group-}" in
		package)
			# TODO: sdist bdist_wheel
			# but wheels don't roll well with our 2/3 split code base
			python setup.py sdist
			install_check_version "pip"
			;;
		*)
			pip install -e .
			httplib2_test_still_run_skipped=1 pytest --fulltrace -k test_303 $@ tests/ || true
			httplib2_test_still_run_skipped=1 pytest --fulltrace -k test_head_301 $@ tests/ || true
			pytest --fulltrace ${test_flags[@]}
			;;
		esac
	else
		if [[ ! -d ./venv-27 ]] ; then
			virtualenv --python=python2.7 ./venv-27
		fi
		if [[ ! -d ./venv-36 ]] ; then
			virtualenv --python=python3.6 ./venv-36
		fi

		./venv-27/bin/pip install -e . -r requirements-test.txt
		./venv-27/bin/pytest ${test_flags[@]}
		./venv-36/bin/pip install -e . -r requirements-test.txt
		./venv-36/bin/pytest ${test_flags[@]}

		# FIXME: too many errors
		# ./venv-27/bin/flake8 python2/
		# ./venv-36/bin/flake8 python3/ tests/

		# TODO: sdist bdist_wheel
		# but wheels don't roll well with our 2/3 split code base
		./venv-36/bin/python setup.py sdist
		install_check_version "./venv-27/bin/pip"
		install_check_version "./venv-36/bin/pip"
	fi
	rm -rf ./_httplib2_test_cache
}

install_check_version() {
	local pip="$1"
	$pip install dist/httplib2*
	version_source=$(python setup.py --version)
	version_installed=$($pip show httplib2 |fgrep Version: |cut -d' ' -f2)
	if [[ "$version_source" != "$version_installed" ]] ; then
		echo "error: installed package version=$version_installed does not match source=$version_source" >&2
		exit 1
	fi
}

main "$@"