Previously I was manually using a Makefile that looked something like this:
.PHONY: all
all: tests
.PHONY: tests
tests: py_env
bash -c 'source py_env/bin/activate && py.test tests'
py_env: requirements_dev.txt setup.py
rm -rf py_env
virtualenv py_env
bash -c 'source py_env/bin/activate && pip install -r requirements_dev.txt'
This had the nice side-effect that if I changed requirements_dev.txt or setup.py, it would rebuild my virtualenv. But feels a bit clunky.
I'd like to use tox
to do a similar thing. I understand tox
has a --recreate
option, but I'd rather call that only when I need to.
My new setup is something like this:
# Makefile
.PHONY: all
all: tests
.PHONY: tests
tests:
tox
and
# tox.ini
[tox]
project = my_project
envlist = py26,py27
[testenv]
install_command = pip install --use-wheel {opts} {packages}
deps = -rrequirements_dev.txt
commands =
py.test {posargs:tests}
An ideal solution would use just things in tox
, however an acceptable solution would involve the Makefile and the --recreate
flag.