Keystone tox cheat sheet

While I grumbled when run_tests.sh was deprecated with just a terse message to go read the docs about tox, I have since switched over. Here is my quick tox transition tutorial.

To list the target environments:

tox -l

Currently this is:

py26
py27
py33
pep8
docs
sample_config

To run anyone of these, you pass it to tox via the -e option:

To build just the docs

tox -edocs

Pep 8 check

tox -epep8

Run Unit tests for python2.7

tox -epy27

Test coverage

tox -e cover

Update config file

 tox -esample_config

Run any of them with the -r flag to recreate the tox repo, but it takes a long time.

Each of the environments listed corresponds to a virtual environment under .tox. If you want to, say, run the keystone server that you have built, from the top directory in your keystone git sandbox:

. .tox/py27/bin/activate
.tox/py27/bin/keystone-all

Note that the same thing will work for a custom keystone client:

cd /opt/stack/python-keystonclient
. .tox/py27/bin/activate
. ~/keystonerc #pronounced keystoner-see
.tox/py27/bin/bin/keystone token-get

If the python33 run fails with the error

‘db type could not be determined’

you should remove the file

rm .testrepository/time.dbm

To just build the virtual environment for development without running the tests:

 tox -epy27 --notest -r

If you have more, let me know and I’ll update the post.

1 thought on “Keystone tox cheat sheet

  1. Adam, underneath ‘db type could not be determined’, the command should be rm /path/to/stack/python-keystoneclient/.testrepository/time.dbm not /path/to/stack/python-keystoneclient/.tox/.testrepository/time.dbm

    Thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.