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
This commit is contained in:
Alistair Coles 2016-03-09 10:17:12 +00:00
parent 68bae91a7f
commit 3ac7cab32b

View File

@ -9,63 +9,64 @@ Coding Guidelines
For the most part we try to follow PEP 8 guidelines which can be viewed For the most part we try to follow PEP 8 guidelines which can be viewed
here: http://www.python.org/dev/peps/pep-0008/ 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 Testing Guidelines
------------------ ------------------
Swift has a comprehensive suite of tests that are run on all submitted code, Swift has a comprehensive suite of tests and pep8 checks that are run on all
and it is recommended that developers execute the tests themselves to submitted code, and it is recommended that developers execute the tests
catch regressions early. Developers are also expected to keep the themselves to catch regressions early. Developers are also expected to keep
test suite up-to-date with any submitted code changes. 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/ 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` tox
* Run Tox from the root of the swift repo:
- `tox`
Remarks: Remarks:
If you installed using: `cd ~/swift; sudo python setup.py develop`, If you installed using ``cd ~/swift; sudo python setup.py develop``, you may
you may need to do: `cd ~/swift; sudo chown -R ${USER}:${USER} swift.egg-info` need to do ``cd ~/swift; sudo chown -R ${USER}:${USER} swift.egg-info`` prior
prior to running tox. 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:: .. note::
As of tox version 2.0.0, most environment variables are not automatically 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 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. after upgrading from tox<2.0.0.
Conversely, if you do not want those environment variables to be passed to 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` Also, if you ever encounter DistributionNotFound, try to use ``tox
or remove the `.tox` directory to force tox to recreate the dependency list. --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 Swift's functional tests may be executed against a :doc:`development_saio` or
other running Swift cluster using the command: other running Swift cluster using the command::
- `tox -e func` tox -e func
The endpoint and authorization credentials to be used by functional tests The endpoint and authorization credentials to be used by functional tests
should be configured in the ``test.conf`` file as described in the section should be configured in the ``test.conf`` file as described in the section