diff --git a/.travis.yml b/.travis.yml index 11d295c0..30772bd4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,34 @@ -sudo: false +sudo: required language: python python: - 2.7 -install: - - pip install codecov - -script: - - coverage run tests.py +services: + - mysql +before_install: + - wget http://files.vlabs.ac.in/downloads/emacs.tar.gz + - tar -xvzf emacs.tar.gz + - cp -r emacs /home/travis/ + - git clone https://github.com/ksripathi/test-project + - cd test-project + - make + - mysql -e 'CREATE DATABASE lds;' + - mysql -e 'show databases;' + - echo "USE mysql;\nUPDATE user SET password=PASSWORD('root') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root + - cd build/code/ + - export PYTHONPATH=$(pwd) + - pip install oursql Flask Flask-SQLAlchemy requests flask-cors flask-testing pyyaml + +install: + - sudo apt-get install emacs -y + +script: + - cd ../../.. + - chmod +x run_tests.sh + - ./run_tests.sh after_success: - - codecov + - cat /etc/issue + diff --git a/README.md b/README.md index c8a7cb3c..2a5e4f1f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ +[![Build Status](https://travis-ci.org/ksripathi/example-python.svg?branch=master)](https://travis-ci.org/ksripathi/example-python) + [Codecov][1] Python Example =========================== + ```sh # 1) install codecov pip install codecov diff --git a/run_tests.sh b/run_tests.sh new file mode 100644 index 00000000..58b4bd00 --- /dev/null +++ b/run_tests.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +status=0 +for f in $(find . -name '*test_*.py') +do + python "$f" + if [ $? -ne 0 ]; + then + status=1 + fi +done +if [ $status -ne 1 ] ; +then + exit 0 +else + exit 1 +fi