-
Notifications
You must be signed in to change notification settings - Fork 5
/
run-tests.sh
executable file
·71 lines (60 loc) · 2.38 KB
/
run-tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
# -*- coding: utf-8 -*-
#
# RERO Invenio Base
# Copyright (C) 2022 RERO.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Usage:
# env DB=postgresql12 SEARCH=elasticsearch7 CACHE=redis MQ=rabbitmq ./run-tests.sh
# Quit on errors
set -o errexit
# Quit on unbound symbols
set -o nounset
# Always bring down docker services
function cleanup() {
# Note: for now we do not need this for the tests.
eval "$(docker-services-cli down --env)"
echo "Done: $?"
}
trap cleanup EXIT
# -> Vulnerability found in sqlalchemy version 1.4.50
# Vulnerability ID: 51668
# -> Vulnerability found in sqlalchemy-utils version 0.38.3
# Vulnerability ID: 42194
# -> Vulnerability found in pip version 22.3.1
# Vulnerability ID: 62044
# -> Vulnerability found in py version 1.11.0
# Vulnerability ID: 51457
safety_exceptions="-i 51668 -i 42194 -i 62044 -i 51457"
msg=$(safety check -o text ${safety_exceptions}) || {
echo "Safety vulnerabilites found for packages:" $(safety check -o bare ${safety_exceptions})
echo "Run:" "safety check -o screen ${safety_exceptions} | grep -i vulnerability" "for more details"
exit 1
}
flask rero utils check_license check_license_config.yml
pydocstyle rero_ils tests docs
isort --check-only --diff rero_invenio_base tests
autoflake -c -r --remove-all-unused-imports --ignore-init-module-imports . &> /dev/null || {
autoflake --remove-all-unused-imports -ri --ignore-init-module-imports .
exit 1
}
python -m sphinx.cmd.build -qnNW docs docs/_build/html
# Note: for now we do not need this for the tests.
export DOCKER_SERVICES_FILEPATH=./docker-services.yml
export ELASTICSEARCH_VERSION=7.10.2
eval "$(docker-services-cli up --search ${SEARCH:-elasticsearch} --env)"
python -m pytest
tests_exit_code=$?
python -m sphinx.cmd.build -qnNW -b doctest docs docs/_build/doctest
exit "$tests_exit_code"