2
# This file is part of Checkbox.
4
# Copyright 2013 Canonical Ltd.
6
# Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
8
# Checkbox is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation, either version 3 of the License, or
11
# (at your option) any later version.
13
# Checkbox is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with Checkbox. If not, see <http://www.gnu.org/licenses/>.
21
# Test script for 'install-dependencies'
22
# ======================================
24
# Creates a new random empty virtualenv with python3 and runs
25
# install-dependencies. Verifies the output of pip freeze at the end.
27
# Ensure that CHECKBOX_TOP is not empty
28
if [ "$CHECKBOX_TOP" = "" ]; then
29
echo "E: this script requires \$CHECKBOX_TOP"
32
# Export CHECKBOX_TOP for install-pip-dependencies
36
# Create a directory for virtualenv and ensure it gets removed later
37
venv_path=$(mktemp -d)
38
trap "rm -rf \"$venv_path\"" EXIT
41
echo "I: creating temporary virtualenv"
42
if ! virtualenv --quiet -p python3 "$venv_path"; then
43
echo "E: cannot create virtualenv"
47
# Activate the virtualenv
48
. "$venv_path/bin/activate"
50
# Install all the packages
51
echo "I: installing dependencies"
52
$CHECKBOX_TOP/support/install-pip-dependencies
54
# Check installation outcome
55
echo "I: checking installed packages"
56
pip freeze > $venv_path/actual-pip-freeze.txt
57
if ! diff -u $CHECKBOX_TOP/support/expected-pip-freeze.txt $venv_path/actual-pip-freeze.txt ; then
58
echo "E: actually installed packages don't match expectations"
63
echo "I: testing complete, all good"