testing - How to make Travis CI to install Python dependencies declared in tests_require? -


i have python package setup.py. has regular dependencies declared in install_requires , development dependencies declared in tests_require, e.g. flake8.

i thought pip install -e . or running python setup.py test install development dependencies , they'll available. however, apparently they're not , struggle setup travis ci build right.

install:   - "pip install -e ." script:   - "python setup.py test"   - "flake8" 

build configured above fail, because flake8 not found valid command. tried invoke flake8 inside of python setup.py test command (via subprocess), without success.

also hate fact flake8 can't made integral part of python setup.py test command, that's story.

i prefer keep of configuration in tox.ini , rely on install , run run. testing use pytest (the solution can modified use other testing frameworks easily).

following files used:

  • tox.ini: automates test
  • .travis.yml: instructions travis
  • setup.py: installation script install package test
  • test_requirements.txt: list of requirements testing

tox.ini

[tox] envlist = py{26,27,33,34}  [testenv] commands =     py.test -sv tests [] deps =     -rtest-requirements.txt 

.travis.yml

sudo: false language: python python:     - 2.6     - 2.7     - 3.3     - 3.4 install:     - pip install tox-travis script:  - tox 

test_requirements.txt

just ordinary requirements file whith ever need in there (e.g. flake8, pytest , other dependencies)

you may see sample @ https://github.com/vlcinsky/awslogs/tree/pbr-setup.py

the fact uses there pbr, coverage , coverall not relevant answer (it works or without pbr).


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -