view .travis.yml @ 5906:712a32f1026b

tests: api: fix intertest dependency on repository locking In test classes based on unittest, tests are executed in alphabetical order. In test classes based on pytest, tests are executed in the order they are specified. This difference revealed a problem in the API tests: - test_api_lock_repo_lock_optional_locked locks the test repository - test_api_get_locks_regular_user gets the current locks and expects it to be empty With unittest as base class, this worked fine because the 'get_locks' group of tests are executed before the 'lock_repo' group (alphabetical order). Using a real pytest-based test class, the order is swapped and the locked repository from the first test invalidates the preconditions of the second test. Fix this specific problem by releasing the lock from test_api_lock_repo_lock_optional_locked. This commit does not fix other interdependencies between tests. For example, test_api_lock_repo_lock_optional_locked expects the existing lock state to be 'locked' but did not lock the repo itself; instead it expects a previous test to have locked. In practice, this is test_api_lock_repo_lock_aquire_optional_userid. A full solution would make each test fully self contained so that tests can be executed in random order. The pytest extension pytest-random can help detecting these problems.
author Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
date Wed, 04 May 2016 08:53:35 +0200
parents a9a1560dad79
children e285bb7abb28
line wrap: on
line source

language: python
python:
  - "2.6"
  - "2.7"

env:  
  - TEST_DB=sqlite:////tmp/kallithea_test.sqlite
  - TEST_DB=mysql://root@127.0.0.1/kallithea_test
  - TEST_DB=postgresql://postgres@127.0.0.1/kallithea_test

services:
  - mysql
  - postgresql

# command to install dependencies
before_script:
  - mysql -e 'create database kallithea_test;'
  - psql -c 'create database kallithea_test;' -U postgres
  - git --version

before_install:
  - sudo apt-get remove git
  - sudo add-apt-repository ppa:pdoes/ppa -y
  - sudo apt-get update -y
  - sudo apt-get install git -y

install:
  - pip install mysql-python psycopg2 mock unittest2
  - pip install . --use-mirrors

# command to run tests
script: nosetests

notifications:
    email:
        - ci@kallithea-scm.org
    irc: "irc.freenode.org#kallithea"

branches:
  only:
    - master