Classes | Functions | Variables
rosbridge_tools::tornado::testing Namespace Reference

Classes

class  _TestMethodWrapper
class  AsyncHTTPSTestCase
class  AsyncHTTPTestCase
class  AsyncTestCase
class  ExpectLog
class  LogTrapTestCase

Functions

def bind_unused_port
def gen_test
def get_async_test_timeout
def get_unused_port
def main

Variables

int _next_port = 10000
 _test_generator
 AsyncHTTPClient = None
 gen = None
 HTTPServer = None
 IOLoop = None
 netutil = None
 SimpleAsyncHTTPClient = None

Function Documentation

Binds a server socket to an available port on localhost.

Returns a tuple (socket, port).

Definition at line 82 of file testing.py.

def rosbridge_tools.tornado.testing.gen_test (   func = None,
  timeout = None 
)
Testing equivalent of ``@gen.coroutine``, to be applied to test methods.

``@gen.coroutine`` cannot be used on tests because the `.IOLoop` is not
already running.  ``@gen_test`` should be applied to test methods
on subclasses of `AsyncTestCase`.

Example::

    class MyTest(AsyncHTTPTestCase):
        @gen_test
        def test_something(self):
            response = yield gen.Task(self.fetch('/'))

By default, ``@gen_test`` times out after 5 seconds. The timeout may be
overridden globally with the ``ASYNC_TEST_TIMEOUT`` environment variable,
or for each test with the ``timeout`` keyword argument::

    class MyTest(AsyncHTTPTestCase):
        @gen_test(timeout=10)
        def test_something_slow(self):
            response = yield gen.Task(self.fetch('/'))

.. versionadded:: 3.1
   The ``timeout`` argument and ``ASYNC_TEST_TIMEOUT`` environment
   variable.

.. versionchanged:: 4.0
   The wrapper now passes along ``*args, **kwargs`` so it can be used
   on functions with arguments.

Definition at line 435 of file testing.py.

Get the global timeout setting for async tests.

Returns a float, the timeout in seconds.

.. versionadded:: 3.1

Definition at line 92 of file testing.py.

Returns a (hopefully) unused port number.

This function does not guarantee that the port it returns is available,
only that a series of get_unused_port calls in a single process return
distinct ports.

.. deprecated::
   Use bind_unused_port instead, which is guaranteed to find an unused port.

Definition at line 66 of file testing.py.

A simple test runner.

This test runner is essentially equivalent to `unittest.main` from
the standard library, but adds support for tornado-style option
parsing and log formatting.

The easiest way to run a test is via the command line::

    python -m tornado.testing tornado.test.stack_context_test

See the standard library unittest module for ways in which tests can
be specified.

Projects with many tests may wish to define a test script like
``tornado/test/runtests.py``.  This script should define a method
``all()`` which returns a test suite and then call
`tornado.testing.main()`.  Note that even when a test script is
used, the ``all()`` test suite may be overridden by naming a
single test on the command line::

    # Runs all tests
    python -m tornado.test.runtests
    # Runs one test
    python -m tornado.test.runtests tornado.test.stack_context_test

Additional keyword arguments passed through to ``unittest.main()``.
For example, use ``tornado.testing.main(verbosity=2)``
to show many test details as they are run.
See http://docs.python.org/library/unittest.html#unittest.main
for full argument list.

Definition at line 606 of file testing.py.


Variable Documentation

Definition at line 63 of file testing.py.

Definition at line 464 of file testing.py.

Definition at line 25 of file testing.py.

Definition at line 26 of file testing.py.

Definition at line 27 of file testing.py.

Definition at line 28 of file testing.py.

Definition at line 29 of file testing.py.

Definition at line 30 of file testing.py.



rosbridge_tools
Author(s): Jonathan Mace
autogenerated on Sun Dec 28 2014 11:43:22