This Page

Psst... hey. You're reading the latest content, but it might be out of sync with code. You can read Nova 2011.1 docs or all OpenStack docs too.

The nova.test Module

Base classes for our unit tests. Allows overriding of flags for use of fakes, and some black magic for inline callbacks.

class nova.test.TestCase(methodName='runTest')

Bases: unittest.case.TestCase

Test case base class for all unit tests

assertDictListMatch(L1, L2)

Assert a list of dicts are equivalent

assertDictMatch(d1, d2)

Assert two dicts are equivalent.

This is a ‘deep’ match in the sense that it handles nested dictionaries appropriately.

NOTE:

If you don’t care (or don’t know) a given value, you can specify the string DONTCARE as the value. This will cause that dict-item to be skipped.
flags(**kw)

Override flag variables for a test

reset_flags()

Resets all flag variables for the test. Runs after each test

setUp()

Run before each test method to initialize test environment

start_service(name, host=None, **kwargs)
tearDown()

Runs after each test method to finalize/tear down test environment.

nova.test.skip_if_fake(func)

Decorator that skips a test if running in fake mode