Skip to content

Commit a4ddc99

Browse files
joachimmetzberggren
authored andcommitted
Moved pylint to stand-alone CI test target (#831)
1 parent 708bbf1 commit a4ddc99

7 files changed

+117
-34
lines changed

.travis.yml

+34-13
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,37 @@
1-
language: python
2-
python:
3-
- '2.7'
4-
- '3.6'
5-
node_js: '8'
1+
matrix:
2+
include:
3+
- name: "Pylint on Ubuntu Xenial (16.04) with Python 3.5"
4+
env: TARGET="pylint"
5+
os: linux
6+
dist: xenial
7+
group: edge
8+
language: python
9+
python: 3.5
10+
node_js: '8'
11+
virtualenv:
12+
system_site_packages: true
13+
- name: "Ubuntu Xenial (16.04) with Python 2.7"
14+
env: TARGET="linux-python27"
15+
os: linux
16+
dist: xenial
17+
group: edge
18+
language: python
19+
python: 2.7
20+
node_js: '8'
21+
- name: "Ubuntu Xenial (16.04) with Python 3.6"
22+
env: TARGET="linux-python36"
23+
os: linux
24+
dist: xenial
25+
group: edge
26+
language: python
27+
python: 3.6
28+
node_js: '8'
629
cache:
7-
- yarn
8-
- pip
9-
30+
- yarn
31+
- pip
1032
install:
11-
- pip install .
12-
- yarn install
13-
33+
- pip install -r requirements.txt
34+
- if test ${TARGET} = "pylint"; then pip install astroid==1.5.3 pylint==1.7.2; fi
35+
- yarn install
1436
script:
15-
- ./run_tests.py --full
16-
- yarn run build
37+
- ./config/travis/run_with_timeout.sh 30 ./config/travis/runtests.sh

config/travis/run_with_timeout.sh

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
#
3+
# Script to run commands on a Travis-CI test VM that otherwise would time out
4+
# after 10 minutes. This replaces travis_wait and outputs stdout of the command
5+
# running.
6+
#
7+
# This file is generated by l2tdevtools update-dependencies.py, any dependency
8+
# related changes should be made in dependencies.ini.
9+
10+
# Exit on error.
11+
set -e
12+
13+
# Usage: ./run_with_timeout.sh [TIMEOUT] [COMMAND] [OPTION] [...]
14+
15+
TIMEOUT=$1;
16+
shift
17+
18+
# Launch a command in the background.
19+
$* &
20+
21+
PID_COMMAND=$!;
22+
23+
# Probe the command every minute.
24+
MINUTES=0;
25+
26+
while kill -0 ${PID_COMMAND} >/dev/null 2>&1;
27+
do
28+
# Print to stdout, seeing this prints a space and a backspace
29+
# there is no visible trace.
30+
echo -n -e " \b";
31+
32+
if test ${MINUTES} -ge ${TIMEOUT};
33+
then
34+
kill -9 ${PID_COMMAND} >/dev/null 2>&1;
35+
36+
echo -e "\033[0;31m[ERROR] command: $* timed out after: ${MINUTES} minute(s).\033[0m";
37+
38+
exit 1;
39+
fi
40+
MINUTES=$(( ${MINUTES} + 1 ));
41+
42+
sleep 60;
43+
done
44+
45+
wait ${PID_COMMAND};
46+
47+
exit $?;

config/travis/runtests.sh

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
#
3+
# Script to run tests on Travis-CI.
4+
#
5+
# This file is generated by l2tdevtools update-dependencies.py, any dependency
6+
# related changes should be made in dependencies.ini.
7+
8+
# Exit on error.
9+
set -e;
10+
11+
if test "${TARGET}" = "pylint";
12+
then
13+
pylint --version
14+
15+
for FILE in `find run_tests.py setup.py config timesketch tests -name \*.py`;
16+
do
17+
echo "Checking: ${FILE}";
18+
19+
pylint --rcfile=.pylintrc ${FILE};
20+
done
21+
22+
for FILE in `find api_client -name \*.py`;
23+
do
24+
echo "Checking: ${FILE}";
25+
26+
PYTHONPATH=api_client/python pylint --rcfile=.pylintrc ${FILE};
27+
done
28+
29+
elif test "${TRAVIS_OS_NAME}" = "linux";
30+
then
31+
python ./run_tests.py --full
32+
33+
yarn run build
34+
fi

requirements.in

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ altair>=2.4.1
3232
Flask-Testing
3333
nose
3434
mock
35-
pylint
3635
coverage
3736

3837
# Remove the following when pip-sync finally stops deleting pkg_resources.

requirements.txt

+2-8
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ altair==2.4.1
33
amqp==2.2.1 # via kombu
44
aniso8601==1.2.1 # via flask-restful
55
asn1crypto==0.24.0 # via cryptography
6-
astroid==1.5.3 # via pylint
76
attrs==18.2.0 # via jsonschema
8-
backports.functools-lru-cache==1.4 # via astroid, pylint
97
bcrypt==3.1.3 # via flask-bcrypt
108
billiard==3.5.0.3 # via celery
119
blinker==1.4
@@ -14,7 +12,7 @@ certifi==2017.7.27.1 # via requests
1412
cffi==1.10.0 # via bcrypt, cryptography
1513
chardet==3.0.4 # via requests
1614
click==6.7 # via flask
17-
configparser==3.5.0 # via entrypoints, pylint
15+
configparser==3.5.0 # via entrypoints
1816
coverage==4.4.1
1917
cryptography==2.4.1
2018
datasketch==1.2.5
@@ -34,15 +32,13 @@ funcsigs==1.0.2 # via mock
3432
gunicorn==19.7.1
3533
idna==2.6 # via cryptography, requests
3634
ipaddress==1.0.22 # via cryptography
37-
isort==4.2.15 # via pylint
3835
itsdangerous==0.24 # via flask
3936
jinja2==2.10 # via altair, flask
4037
jsonschema==3.0.0 # via altair
4138
kombu==4.1.0 # via celery
4239
lazy-object-proxy==1.3.1 # via astroid
4340
mako==1.0.7 # via alembic
4441
markupsafe==1.0 # via jinja2, mako
45-
mccabe==0.6.1 # via pylint
4642
mock==2.0.0
4743
neo4jrestclient==2.1.1
4844
nose==1.3.7
@@ -52,16 +48,14 @@ parameterized==0.6.1
5248
pbr==3.1.1 # via mock
5349
pycparser==2.18 # via cffi
5450
pyjwt==1.6.4
55-
pylint==1.7.2
5651
pyrsistent==0.14.11 # via jsonschema
5752
python-dateutil==2.6.1
5853
python-editor==1.0.3 # via alembic
5954
pytz==2017.2 # via celery, flask-restful, pandas
6055
pyyaml==4.2b4
6156
redis==2.10.6
6257
requests==2.20.1
63-
singledispatch==3.4.0.3 # via astroid, pylint
64-
six==1.12.0 # via altair, astroid, bcrypt, cryptography, flask-restful, jsonschema, mock, pylint, pyrsistent, python-dateutil, singledispatch
58+
six==1.12.0 # via altair, bcrypt, cryptography, flask-restful, jsonschema, mock, pyrsistent, python-dateutil
6559
sqlalchemy==1.1.13
6660
toolz==0.9.0 # via altair
6761
typing==3.6.6 # via altair

run_tests.py

-12
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,9 @@ def run_python_tests(coverage=False):
2121
finally:
2222
subprocess.check_call(['rm', '-f', '.coverage'])
2323

24-
def run_python_linter():
25-
subprocess.check_call(['pylint', 'timesketch'])
26-
subprocess.check_call(
27-
'PYTHONPATH=api_client/python/:$PYTHONPATH'
28-
+ ' pylint timesketch_api_client',
29-
shell=True,
30-
)
31-
subprocess.check_call(['pylint', 'run_tests'])
32-
subprocess.check_call(['pylint', 'setup'])
33-
3424
def run_python(args):
3525
if not args.no_tests:
3626
run_python_tests(coverage=args.coverage)
37-
if not args.no_lint:
38-
run_python_linter()
3927

4028
def run_javascript_tests(coverage=False):
4129
if coverage:

setup.py

100644100755
File mode changed.

0 commit comments

Comments
 (0)