提交 149b4f7e 编写于 作者: C Cleber Rosa

Doc review: turn "running tests on nose" section into a unittest section

At its core, what's really important to get accross is that an Avocado test
is compatible with unittest.TestCase, and it can be run with compatible
test runners.
Signed-off-by: NCleber Rosa <crosa@redhat.com>
上级 9b804c7c
......@@ -260,14 +260,13 @@ Executing an Avocado test gives::
INTERRUPT : 0
TIME : 1.00 s
Running tests with nosetests
============================
Running tests under other :mod:`unittest` runners
-------------------------------------------------
`nose <https://nose.readthedocs.org/>`__ is another Python testing framework
that is also compatible with :mod:`unittest`.
`nose <https://nose.readthedocs.org/>`__ is a Python testing framework with
similar goals as Avocado, except that avocado also intends to provide tools to
assemble a fully automated test grid, plus richer test API for tests on the
Linux platform. Regardless, the fact that an Avocado class is also an unittest
cass, you can run them with the ``nosetests`` application::
Because of that, you can run avocado tests with the ``nosetests`` application::
$ nosetests examples/tests/sleeptest.py
.
......@@ -276,6 +275,28 @@ cass, you can run them with the ``nosetests`` application::
OK
Conversely, you can also use the standard :func:`unittest.main` entry point to run an
Avocado test. Check out the following code, to be saved as ``dummy.py``::
from avocado import Test
from unittest import main
class Dummy(Test):
def test(self):
self.assertTrue(True)
if __name__ == '__main__':
main()
It can be run by::
$ python dummy.py
.
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK
Setup and cleanup methods
=========================
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册