|
1 | 1 | language: python |
2 | 2 | python: |
3 | 3 | - "2.7" |
4 | | - - "2.6" |
5 | 4 |
|
6 | 5 | install: |
| 6 | + - sudo apt-get update && sudo apt-get install -y python-pip libgnutls28-dev libssl-dev |
7 | 7 | - ./test/setup_module_test.sh |
8 | | - - pip install importlib # this is a requirement of shinken |
9 | | - - export PYTHONPATH=$PYTHONPATH:~/shinken # we need shinken.. |
10 | | - - export PYTHONPATH=$PYTHONPATH:~/shinken/test |
11 | | - - export PYTHONPATH=$PYTHONPATH:~/mod-livestatus/test # we also need mock_livestatus from mod-livestatus.. |
12 | 8 |
|
13 | 9 | script: |
14 | | - - mongodir=$(pwd) |
15 | | - # tests need to run from shinken test directory for access to test config files |
16 | | - # (as long as the test config files are referenced with a relative path) |
17 | | - - cd ~/shinken/test |
18 | | - - nosetests -vx --with-coverage --cover-package=modules $mongodir/test |
| 10 | + # Unit tests |
| 11 | + - cur_dir=$PWD |
| 12 | + - echo "Current directory '$cur_dir' ..." |
| 13 | + - export PYTHONPATH=$PYTHONPATH:$PWD |
| 14 | + - export PYTHONPATH=$PYTHONPATH:$PWD/test/tmp/shinken # we also need shinken test/modules... |
| 15 | + - export PYTHONPATH=$PYTHONPATH:$PWD/test/tmp/shinken/test # we also need shinken test/modules... |
| 16 | + - export PYTHONPATH=$PYTHONPATH:$PWD/test/tmp/shinken/test/modules/livestatus # we also need mock_livestatus from mod-livestatus.. |
| 17 | + - echo "Python path '$PYTHONPATH' ..." |
| 18 | + - cd test/tmp/shinken/test |
| 19 | +# - pytest -vv --durations=0 --no-print-logs --cov="$cur_dir"/module --cov-config "$cur_dir"/test/.coveragerc "$cur_dir"/test/test_*.py |
| 20 | + - pytest -vv --durations=0 --no-print-logs --cov="$cur_dir"/module --cov-report=xml --cov-config "$cur_dir"/test/.coveragerc "$cur_dir"/test/test_*.py |
| 21 | + |
| 22 | + # Static code analysis |
| 23 | + - cd "$cur_dir" |
| 24 | + # -- pycodestyle (former pep8) |
| 25 | + # E731 do not assign a lambda expression, use a def |
| 26 | + - pycodestyle --max-line-length=120 --ignore=E402,W503,E731 --exclude='*.pyc' module |
| 27 | + # -- pylint |
| 28 | + - pylint --rcfile=.pylintrc -r no module |
| 29 | + # -- pep257 |
| 30 | + # - pep257 --select=D300 alignak |
19 | 31 |
|
20 | 32 | after_success: |
21 | | - coveralls |
| 33 | + - bash <(curl -s https://codecov.io/bash) -f test/tmp/shinken/test/coverage.xml |
22 | 34 |
|
23 | 35 | notifications: |
24 | 36 | email: false |
0 commit comments