Update testing-overview.txt

- update for actual tests directory structure used
- describe how to use tox to run only a subset of tests
- add hint on how to run tests when debuggers are used
- also remove non-existent heat/testing/README.rst from MANINFEST.in

Change-Id: I1441f79a006a4dfba2d7ee54ca6f4f7577205c0d
This commit is contained in:
Pavlo Shchelokovskyy 2014-12-11 14:20:36 +02:00
parent d33a5837d1
commit a6fdab0432
2 changed files with 28 additions and 15 deletions

View File

@ -14,7 +14,6 @@ include heat/cloudinit/part-handler.py
include heat/db/sqlalchemy/migrate_repo/migrate.cfg include heat/db/sqlalchemy/migrate_repo/migrate.cfg
include heat/db/sqlalchemy/migrate_repo/README include heat/db/sqlalchemy/migrate_repo/README
include heat/openstack/common/README include heat/openstack/common/README
include heat/testing/README.rst
include heat/tests/examples/tags.txt include heat/tests/examples/tags.txt
include heat/tests/testing-overview.txt include heat/tests/testing-overview.txt
include heat/tests/v1_1/testfile.txt include heat/tests/v1_1/testfile.txt

View File

@ -1,23 +1,20 @@
Heat testing Heat testing
------------ ------------
All tests are to be placed in the heat/tests directory. The directory All unit tests are to be placed in the heat/tests directory,
is organized by test type (unit, functional, etc). Within each type and tests might be organized by tested subsystem. Each subsystem directory
directory one may create another directory for additional test files as must contain a separate blank __init__.py for tests discovery to function.
well as a separate __init__.py, which should be blank.
An example directory structure illustrating the above: An example directory structure illustrating the above:
heat/tests heat/tests
|-- examples |-- autoscaling
| |-- __init__.py | |-- __init__.py
| |-- test1.py | |-- test1.py
| |-- test2.py | |-- test2.py
| |-- test3.py | |-- test3.py
|-- __init__.py |-- __init__.py
`-- unit |-- test_template_convert.py
|-- __init__.py
|-- test_template_convert.py
If a given test has no overlapping requirements (variables or same If a given test has no overlapping requirements (variables or same
routines) a new test does not need to create a subdirectory under the routines) a new test does not need to create a subdirectory under the
@ -30,19 +27,36 @@ Testrepository - http://pypi.python.org/pypi/testrepository is used to
find and run tests, parallelize their runs, and record timing/results. find and run tests, parallelize their runs, and record timing/results.
If new dependencies are introduced upon the development of a test, the If new dependencies are introduced upon the development of a test, the
tools/test-requires file needs to be updated so that the virtual test-requirements.txt file needs to be updated so that the virtual
environment will be able to successfully execute all tests. environment will be able to successfully execute all tests.
Running the tests Running the tests
----------------- -----------------
During development, the simplest way to run tests is to simply invoke Advised way of running tests is the same as in OpenStack testing
testr directly. infrastructure, that is using tox.
$ testr run $ tox
To run the tests with a clean virtual env in the same manner as the This by default will run unit tests suite with Python 2.7 and PEP8/HACKING
OpenStack testing infrastructure does so, use tox. style checks. To run only one type of tests you can explicitly provide tox
with the test environment to use.
$ tox -epy27 # test suite on python 2.7 $ tox -epy27 # test suite on python 2.7
$ tox -epep8 # run full source code checker $ tox -epep8 # run full source code checker
To run only a subset of tests, you can provide tox with a regex argument
defining which tests to execute.
$ tox -epy27 -- VolumeTests
To use debugger like pdb during test run, one has to run tests directly
with other, non-concurrent test runner instead of testr.
That also presumes that you have a virtual env with all heat dependencies active.
Below is an example bash script using testtools test runner that also allows
running single tests by providing a regex.
#! /usr/bin/env sh
testlist=$(mktemp)
testr list-tests "$1" > $testlist
python -m testtools.run --load-list $testlist