zun/doc/source/dev/unit_tests.rst
Hongbin Lu d17fe49109 Document how to run tempest tests locally
* Add a dev document for how to run tempest tests locally.
* Pull the instruction of running unit tests out of quickstart
  guide and make it a standalone document.
* Fix the unit tests guide to make it work at Ubuntu 16.04.
* Add a sample local.conf as minimal to run devstack
* Add osprofiler guide to the index page.

Change-Id: I31794733c9225478f5df029279c8415a23b1caa0
2017-04-04 04:05:41 +00:00

75 lines
2.1 KiB
ReStructuredText

..
Licensed under the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
==============
Run unit tests
==============
This is a guide for developers who want to run unit tests in their local
machine.
Prerequisite
============
Install OS-specific prerequisites::
# Ubuntu/Debian (recommend Ubuntu 16.04):
sudo apt-get update
sudo apt-get install -y libmysqlclient-dev build-essential python-dev \
python3.5-dev git libssl-dev libffi-dev \
python-gdbm
Install pip::
curl -s https://bootstrap.pypa.io/get-pip.py | sudo python
Install common prerequisites::
sudo pip install virtualenv flake8 tox testrepository git-review os-testr
You may need to explicitly upgrade virtualenv if you've installed the one
from your OS distribution and it is too old (tox will complain). You can
upgrade it individually, if you need to::
sudo pip install -U virtualenv
Zun source code should be pulled directly from git::
# from your home or source directory
cd ~
git clone https://git.openstack.org/openstack/zun
cd zun
Running the tests
=================
All unit tests should be run using tox. To run Zun's entire test suite::
# run all tests (unit and pep8)
tox
To run a specific test, use a positional argument for the unit tests::
# run a specific test for Python 2.7
tox -epy27 -- test_container
You may pass options to the test programs using positional arguments::
# run all the Python 2.7 unit tests (in parallel!)
tox -epy27 -- --parallel
To run only the pep8/flake8 syntax and style checks::
tox -epep8