sudo: false
language: python
python:
#  - "3.2"
#  - "3.3"
  - "3.4"

addons:
  postgresql: "9.3"

# command to install dependencies
# Note: there's an echo at the end of pip install. It allows to override the default return code which is not 0
# because some packages need to be ugraded to python3 (invalid python syntax because of python2 source code)
#
# pip install -r is run 2 times in order to really install tgapp-resetpassword (to investigate)
#
install:
  - "cd tracim && python setup.py develop; cd -"
  - "pip install -r install/requirements.txt; echo"
  - "./bin/tg2env-patch 1 /home/travis/virtualenv/python3.2.5/lib/python3.2/site-packages"
  - "pip install -r install/requirements.txt; echo"
  - "./bin/tg2env-patch 2 /home/travis/virtualenv/python3.2.5/lib/python3.2/site-packages"
  - "pip install coveralls"

before_script:
  - "psql -c 'create database tracim_test;' -U postgres"
  - "cp ${TRAVIS_BUILD_DIR}/tracim/development.ini.base ${TRAVIS_BUILD_DIR}/tracim/development.ini"
#  - "cd ${TRAVIS_BUILD_DIR}/tracim && gearbox setup-app -c ${TRAVIS_BUILD_DIR}/tracim/test.ini"
  - "cd ${TRAVIS_BUILD_DIR}/tracim && gearbox setup-app"
#  - "cd ${TRAVIS_BUILD_DIR}/tracim && gearbox migrate -c ${TRAVIS_BUILD_DIR}/tracim/test.ini upgrade"

# command to run tests
script: "cd ${TRAVIS_BUILD_DIR}/tracim && nosetests -c ${TRAVIS_BUILD_DIR}/tracim/test.ini -v --with-coverage --cover-package=tracim --cover-erase"

after_success:
- coveralls