-
Notifications
You must be signed in to change notification settings - Fork 35
/
run_tests.sh
executable file
·70 lines (48 loc) · 1.19 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
#!/usr/bin/env bash
# Copyright (c) 2017-2023 Postgres Professional
set -eux
# choose python version
echo python version is $PYTHON_VERSION
VIRTUALENV="virtualenv --python=/usr/bin/python$PYTHON_VERSION"
PIP="pip$PYTHON_VERSION"
# fail early
echo check that pg_config is in PATH
command -v pg_config
# prepare environment
VENV_PATH=/tmp/testgres_venv
rm -rf $VENV_PATH
$VIRTUALENV $VENV_PATH
export VIRTUAL_ENV_DISABLE_PROMPT=1
source $VENV_PATH/bin/activate
# install utilities
$PIP install coverage flake8 psutil Sphinx
# install testgres' dependencies
export PYTHONPATH=$(pwd)
$PIP install .
# test code quality
flake8 .
# remove existing coverage file
export COVERAGE_FILE=.coverage
rm -f $COVERAGE_FILE
# run tests (PATH)
time coverage run -a tests/test_simple.py
# run tests (PG_BIN)
time \
PG_BIN=$(dirname $(which pg_config)) \
ALT_CONFIG=1 \
coverage run -a tests/test_simple.py
# run tests (PG_CONFIG)
time \
PG_CONFIG=$(which pg_config) \
ALT_CONFIG=1 \
coverage run -a tests/test_simple.py
# show coverage
coverage report
# build documentation
cd docs
make html
cd ..
# attempt to fix codecov
set +eux
# send coverage stats to Codecov
bash <(curl -s https://codecov.io/bash)