forked from piskvorky/smart_open
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravis_ci_helpers.sh
executable file
·58 lines (42 loc) · 1.11 KB
/
travis_ci_helpers.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
#!/bin/bash
set -e
set -x
export PYTEST_ADDOPTS="--reruns 3 --reruns-delay 1"
is_travis_secure_vars_available(){
if [[ "${TRAVIS_SECURE_ENV_VARS}" == "true" ]]; then
return 0
else
echo "[WARNING] TRAVIS_SECURE_ENV_VARS=${TRAVIS_SECURE_ENV_VARS} (but should be true)"
return 1
fi
}
benchmark(){
if ! is_travis_secure_vars_available; then
return 0
fi
SO_S3_URL="${SO_S3_URL}"/`python -c "from uuid import uuid4;print(uuid4())"`;
COMMIT_HASH=`git rev-parse HEAD`;
pytest integration-tests/test_s3.py --benchmark-save="${COMMIT_HASH}";
aws s3 cp .benchmarks/*/*.json "${SO_S3_RESULT_URL}";
aws s3 rm --recursive "${SO_S3_URL}";
}
integration(){
pytest integration-tests/test_http.py integration-tests/test_207.py
if ! is_travis_secure_vars_available; then
return 0
fi
pytest integration-tests/test_s3_ported.py;
}
doctest(){
if ! is_travis_secure_vars_available; then
return 0
fi
python -m doctest README.rst -v;
}
enable_moto_server(){
moto_server -p5000 2>/dev/null&
}
disable_moto_server(){
lsof -i tcp:5000 | tail -n1 | cut -f2 -d" " | xargs kill -9
}
"$@"