-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathrun_tests.sh
executable file
·62 lines (42 loc) · 1.26 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
#!/usr/bin/env bash
# Copyright (c) 2017-2023 Postgres Professional
set -eux
if [ -z ${TEST_FILTER+x} ]; \
then export TEST_FILTER="TestgresTests or (TestTestgresCommon and (not remote_ops))"; \
fi
# fail early
echo check that pg_config is in PATH
command -v pg_config
# prepare python environment
VENV_PATH="/tmp/testgres_venv"
rm -rf $VENV_PATH
virtualenv --python="/usr/bin/python${PYTHON_VERSION}" "${VENV_PATH}"
export VIRTUAL_ENV_DISABLE_PROMPT=1
source "${VENV_PATH}/bin/activate"
pip install coverage flake8 psutil Sphinx pytest pytest-xdist psycopg2 six psutil
# 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 -m pytest -l -v -n 4 -k "${TEST_FILTER}"
# run tests (PG_BIN)
PG_BIN=$(pg_config --bindir) \
time coverage run -a -m pytest -l -v -n 4 -k "${TEST_FILTER}"
# run tests (PG_CONFIG)
PG_CONFIG=$(pg_config --bindir)/pg_config \
time coverage run -a -m pytest -l -v -n 4 -k "${TEST_FILTER}"
# 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)