[tox]
envlist = py27
skipsdist=True

[testenv]
basepython = python2.7
commands = 
    pip uninstall -y pysqlcipher
    pip install --install-option="--bundled" pysqlcipher
    py.test -x --ignore=tests/benchmarks \
                   --cov-report=html \
                   --cov-report=term \
                   --cov=leap.soledad \
                   {posargs}
usedevelop = True
deps =
    coverage
    pytest
    pytest-cov
    pytest-twisted
    mock
    testscenarios
    setuptools-trial
    pdbpp
    couchdb
    requests
    service_identity
# install soledad from current tree
    -e../
setenv =
    HOME=/tmp
    TERM=xterm
    XDG_CACHE_HOME=./.cache/
install_command = pip install {opts} {packages}

[testenv:py34]
basepython = python3.4
commands = py.test --ignore=tests/benchmarks \
                   --cov-report=html \
                   --cov-report=term \
                   --cov=leap.soledad \
                   {posargs}
usedevelop = True
deps =
    coverage
    pytest
    pytest-cov
    pytest-twisted
    mock
    testscenarios
    setuptools-trial
    couchdb
    requests
    service_identity
# install soledad local packages
    -e../common
    -e../client
    -e../server
setenv =
    HOME=/tmp
    TERM=xterm
install_command = pip3 install {opts} {packages}

[testenv:benchmark]
deps =
    {[testenv]deps}
    psutil
    numpy
    #pytest-benchmark>=3.1.0a2
    git+https://github.com/ionelmc/pytest-benchmark.git@master
    elasticsearch
    certifi
commands =
# use a bundled version of pysqlcipher to ensure HAVE_USLEEP is set and we
# don't have problems with concurrent db access.
    pip uninstall -y pysqlcipher
    pip install --install-option="--bundled" pysqlcipher
    ./check-pysqlcipher.py
# and only then run benchmark
    py.test --benchmark-only -m 'not synchronous' {posargs}
passenv = HOST_HOSTNAME

[testenv:code-check]
changedir = ..
deps =
    pep8
    flake8
commands =
    pep8
    flake8

[testenv:parallel]
deps =
    {[testenv]deps}
    pytest-xdist
install_command = pip install {opts} {packages}
commands = py.test --ignore=tests/benchmarks {posargs} -n 4