# `cement.utils.test`

Cement testing utilities.

class `cement.utils.test.``CementCoreTestCase`(*args, **kw)

  Bases: `cement.utils.test.CementTestCase`

class `cement.utils.test.``CementExtTestCase`(*args, **kw)

  Bases: `cement.utils.test.CementTestCase`

class `cement.utils.test.``CementTestCase`(*args, **kw)

  Bases: `unittest.case.TestCase`

  A sub-class of unittest.TestCase.

  `app_class`

    The test class that is used by self.make_app to create an app.

    alias of `TestApp`

  `eq`(a, b, msg=None)

    Shorthand for ‘assert a == b, “%r != %r” % (a, b)’.

  `make_app`(*args, **kw)

    Create a generic app using TestApp. Arguments and Keyword Arguments are passed to the app.

  `ok`(expr, msg=None)

    Shorthand for assert.

  `reset_backend`()

    Remove all registered hooks and handlers from the backend.

  `setUp`()

    Sets up self.app with a generic TestApp(). Also resets the backend hooks and handlers so that everytime an app is created it is setup clean each time.

  `tearDown`()

    Tears down the test environment (if necessary), removes any temporary files/directories, etc.

class `cement.utils.test.``TestApp`(label=None, **kw)

  Bases: `cement.core.foundation.CementApp`

  Basic CementApp for generic testing.

class `cement.utils.test.``raises`

  Test must raise one of expected exceptions to pass.

  Example use:

      @raises(TypeError, ValueError)
      def test_raises_type_error():
          raise TypeError("This test passes")

      @raises(Exception)
      def test_that_fails_by_passing():
          pass

  If you want to test many assertions about exceptions in a single test, you may want to use assert_raises instead.

`cement.utils.test.``ok`(expr, msg=None)

  Shorthand for assert. Saves 3 whole characters!

`cement.utils.test.``eq`(a, b, msg=None)

  Shorthand for ‘assert a == b, “%r != %r” % (a, b)