]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Remove examples and update testing-overview.txt
authorClint Byrum <clint@fewbar.com>
Thu, 25 Apr 2013 23:16:20 +0000 (16:16 -0700)
committerClint Byrum <clint@fewbar.com>
Tue, 30 Apr 2013 20:51:31 +0000 (13:51 -0700)
With the migration to testrepository, many of the instructions are
obsolete. Also the examples are not needed as we have plenty of fine
examples available in the code itself.

Change-Id: I87524eaab4c39ea75d7e53fb11ffe103d5339cc3

heat/tests/examples/__init__.py [deleted file]
heat/tests/examples/tags.txt [deleted file]
heat/tests/examples/test1.py [deleted file]
heat/tests/examples/test2.py [deleted file]
heat/tests/examples/test3.py [deleted file]
heat/tests/testing-overview.txt

diff --git a/heat/tests/examples/__init__.py b/heat/tests/examples/__init__.py
deleted file mode 100644 (file)
index 3fe375c..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-def setup():
-    print "package setup complete"
-
-
-def teardown():
-    print "package teardown complete"
diff --git a/heat/tests/examples/tags.txt b/heat/tests/examples/tags.txt
deleted file mode 100644 (file)
index beece4e..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-type
-area
diff --git a/heat/tests/examples/test1.py b/heat/tests/examples/test1.py
deleted file mode 100644 (file)
index 9e75a01..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-###
-### an unparented test -- no encapsulating class, just any fn starting with
-### 'test'.
-## http://darcs.idyll.org/~t/projects/nose-demo/simple/tests/test_stuff.py.html
-###
-
-import sys
-import nose
-from nose.plugins.attrib import attr
-from nose import with_setup
-
-# module level
-
-
-def setUp():
-    print "test1 setup complete"
-
-
-def tearDown():
-    print "test1 teardown complete"
-
-
-@with_setup(setUp, tearDown)  # test level
-@attr(tag=['example', 'func'])
-@attr(speed='fast')
-def test_a():
-    assert 'a' == 'a'
-    print "assert a"
-
-
-def test_b():
-    assert 'b' == 'b'
-    print "assert b"
-
-if __name__ == '__main__':
-    sys.argv.append(__file__)
-    nose.main()
diff --git a/heat/tests/examples/test2.py b/heat/tests/examples/test2.py
deleted file mode 100644 (file)
index 632fc98..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-###
-### non-unittest derived test -- class is instantiated, then functions
-### starting with 'test' are executed.
-## http://darcs.idyll.org/~t/projects/nose-demo/simple/tests/test_stuff.py.html
-###
-
-import sys
-import nose
-from nose.plugins.attrib import attr
-
-# sets attribute on all test methods
-
-
-@attr(tag=['example', 'class'])
-@attr(speed='fast')
-class TestClass:
-    def test2(self):
-        assert 'b' == 'b'
-        print "assert b"
-
-    def setUp(self):
-        print "test2 setup complete"
-
-    def tearDown(self):
-        print "test2 teardown complete"
-
-
-if __name__ == '__main__':
-    sys.argv.append(__file__)
-    nose.main()
diff --git a/heat/tests/examples/test3.py b/heat/tests/examples/test3.py
deleted file mode 100644 (file)
index 8913872..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-###
-### the standard unittest-derived test
-## http://darcs.idyll.org/~t/projects/nose-demo/simple/tests/test_stuff.py.html
-###
-
-import sys
-import nose
-import unittest
-from nose.plugins.attrib import attr
-
-# sets attribute on all test methods
-
-
-@attr(tag=['example', 'unit'])
-@attr(speed='fast')
-class ExampleTest(unittest.TestCase):
-    def test_a(self):
-        self.assertEqual(1, 1)
-
-    def setUp(self):
-        print "test3 setup complete"
-
-    def tearDown(self):
-        print "test3 teardown complete"
-
-
-if __name__ == '__main__':
-    sys.argv.append(__file__)
-    nose.main()
index e9b613006eb742c23b6bf9bdd8506202a3de9159..32360c8a5b89092c5f7fcf1d943a95ce23d4d9c8 100644 (file)
@@ -1,18 +1,17 @@
 Heat testing
 ------------
 
-All tests are to be placed in the heat/tests directory. The directory is
-organized by test type (unit, functional, etc). Within each type
+All tests are to be placed in the heat/tests directory. The directory
+is organized by test type (unit, functional, etc). Within each type
 directory one may create another directory for additional test files as
-well as a separate __init__.py, which allows setup and teardown code to
-be shared with the tests present in the same directory.
+well as a separate __init__.py, which should be blank.
 
 An example directory structure illustrating the above:
 
 heat/tests
 |-- examples
-|   |-- __init__.py <-- tests1-3 will execute the fixtures (setup and
-|   |-- test1.py        teardown routines) only once
+|   |-- __init__.py
+|   |-- test1.py
 |   |-- test2.py
 |   |-- test3.py
 |-- __init__.py
@@ -27,77 +26,8 @@ test type.
 Implementing a test
 -------------------
 
-Nose, the testing framework - http://pypi.python.org/pypi/nose, finds on
-demand available tests to run. The name of the file must contain "test"
-or "Test" at a word boundary. The recommended format is for the test to
-be named test_<NAME>.
-
-There are many different ways to write a test. Three different ways are
-present in the tests/examples directory. The differences are slight
-enough to just describe the make up of just one test.
-
----
-Example 1:
-
-import sys
-import nose
-from nose.plugins.attrib import attr
-from nose import with_setup
-
-# module level
-def setUp():
-    print "test1 setup complete"
-
-def tearDown():
-    print "test1 teardown complete"
-
-@with_setup(setUp, tearDown) # test level
-@attr(tag=['example', 'func'])
-def test_a():
-    assert 'a' == 'a'
-    print "assert a"
-
-def test_b():
-    assert 'b' == 'b'
-    print "assert b"
-
-# allows testing of the test directly, shown below
-if __name__ == '__main__':
-    sys.argv.append(__file__)
-    nose.main()
----
-
-Example 1 illustrates fixture execution at the test, module, and package
-level:
-
-$ python test1.py -s
-package setup complete
-test1 setup complete
-test1 setup complete
-assert a
-test1 teardown complete
-.assert b
-.test1 teardown complete
-package teardown complete
-
-----------------------------------------------------------------------
-Ran 2 tests in 0.001s
-
-OK
-
-
-All fixtures are optional. In the above output you can trace the order
-execution of the fixtures relative to the tests. Fixtures at the class
-level are present in example 2, which consists of simply defining them
-within the class. 
-
-Note the attribute decorator with a list of values, which functionality
-is provided via the attributeselector plugin. This "tag" allows running
-tests all matching the assigned attribute(s). Tests should always
-include the tag attribute with at least these values: <test type>,
-<test area>. Also an attribute of speed should be used with a value of
-either slow, normal, or fast. Following this convention allows for finer
-granular testing without having to find the specific tests to run.
+Testrepository - http://pypi.python.org/pypi/testrepository is used to
+find and run tests, parallelize their runs, and record timing/results.
 
 If new dependencies are introduced upon the development of a test, the
 tools/test-requires file needs to be updated so that the virtual
@@ -106,21 +36,14 @@ environment will be able to successfully execute all tests.
 Running the tests
 -----------------
 
-There is a run_tests.sh script in the top level of the tree. The script
-will by default execute all found tests, but can be modified with the
-tag argument:
-
-$ ./run_tests.sh -V -a tag=example  # (runs all the examples)
+During development, the simplest way to run tests is to simply invoke
+testr directly.
 
-There are two important options provided by the run_tests.sh script that
-should have special attention. The '--virtual-env' or '-V' will build
-and run all the tests inside of an isolated python environment located
-in the .venv directory. It's sort of like mock just for python :)
+$ testr run
 
-The other option of note is the '--pep8' or '-p' flag. This is a python
-style checker that is good to run periodically. Pep8 is automatically
-executed when tests are run inside the virtual environment since pep8 is
-intentionally installed.
+To run the tests with a clean virtual env in the same manner as the
+OpenStack testing infrastructure does so, use tox.
 
-Please see ./run_tests.sh -h for future enhancements and/or minor
-non-documented functionality.
+$ tox -epy27 # test suite on python 2.7
+$ tox -epy26 # test suite on python 2.6
+$ tox -epep8 # run full source code checker