From 3ac7cab32bcd08e032ad587a5982bdc997fc20c1 Mon Sep 17 00:00:00 2001 From: Alistair Coles Date: Wed, 9 Mar 2016 10:17:12 +0000 Subject: [PATCH] Remove reference to py26 in tox testing instructions Also change some rst formatting and clarify that tox is used to run more than just *unit* tests. Change-Id: I263af7b4f7a554da3a391cf5104af573c89e3825 --- doc/source/development_guidelines.rst | 63 ++++++++++++++------------- 1 file changed, 32 insertions(+), 31 deletions(-) diff --git a/doc/source/development_guidelines.rst b/doc/source/development_guidelines.rst index 2f3d70f78e..fd3607015f 100644 --- a/doc/source/development_guidelines.rst +++ b/doc/source/development_guidelines.rst @@ -9,63 +9,64 @@ Coding Guidelines For the most part we try to follow PEP 8 guidelines which can be viewed here: http://www.python.org/dev/peps/pep-0008/ -There is a useful pep8 command line tool for checking files for pep8 -compliance which can be installed with ``easy_install pep8``. - ------------------ Testing Guidelines ------------------ -Swift has a comprehensive suite of tests that are run on all submitted code, -and it is recommended that developers execute the tests themselves to -catch regressions early. Developers are also expected to keep the -test suite up-to-date with any submitted code changes. +Swift has a comprehensive suite of tests and pep8 checks that are run on all +submitted code, and it is recommended that developers execute the tests +themselves to catch regressions early. Developers are also expected to keep +the test suite up-to-date with any submitted code changes. -Swift's suite of unit tests can be executed in an isolated environment +Swift's tests and pep8 checks can be executed in an isolated environment with Tox: http://tox.testrun.org/ -To execute the unit tests: +To execute the tests: -* Install Tox: +* Install Tox:: - - `pip install tox` + pip install tox -* If you do not have python 2.6 installed (as in 12.04): - - Add `export TOXENV=py27,pep8` to your `~/.bashrc` +* Run Tox from the root of the swift repo:: - - `. ~/.bashrc` - -* Run Tox from the root of the swift repo: - - - `tox` + tox Remarks: - If you installed using: `cd ~/swift; sudo python setup.py develop`, - you may need to do: `cd ~/swift; sudo chown -R ${USER}:${USER} swift.egg-info` - prior to running tox. + If you installed using ``cd ~/swift; sudo python setup.py develop``, you may + need to do ``cd ~/swift; sudo chown -R ${USER}:${USER} swift.egg-info`` prior + to running tox. -* Optionally, run only specific tox builds: +* By default ``tox`` will run all of the unit test and pep8 checks listed in + the ``tox.ini`` file ``envlist`` option. A subset of the test environments + can be specified on the tox command line or by setting the ``TOXENV`` + environment variable. For example, to run only the pep8 checks and python2.7 + unit tests use:: - - `tox -e pep8,py27` + tox -e pep8,py27 + + or:: + + TOXENV=py27,pep8 tox .. note:: As of tox version 2.0.0, most environment variables are not automatically - passed to the test environment. Swift's `tox.ini` overrides this default + passed to the test environment. Swift's ``tox.ini`` overrides this default behavior so that variable names matching ``SWIFT_*`` and ``*_proxy`` will be - passed, but you may need to run `tox --recreate` for this to take effect + passed, but you may need to run ``tox --recreate`` for this to take effect after upgrading from tox<2.0.0. Conversely, if you do not want those environment variables to be passed to - the test environment then you will need to unset them before calling tox. + the test environment then you will need to unset them before calling ``tox``. - Also, if you ever encounter DistributionNotFound, try to use `tox --recreate` - or remove the `.tox` directory to force tox to recreate the dependency list. + Also, if you ever encounter DistributionNotFound, try to use ``tox + --recreate`` or remove the ``.tox`` directory to force tox to recreate the + dependency list. -The functional tests may be executed against a :doc:`development_saio` or -other running Swift cluster using the command: +Swift's functional tests may be executed against a :doc:`development_saio` or +other running Swift cluster using the command:: -- `tox -e func` + tox -e func The endpoint and authorization credentials to be used by functional tests should be configured in the ``test.conf`` file as described in the section