Package testoob :: Module testing
[show private | hide private]
[frames | no frames]

Module testoob.testing

Useful testing fuctions.
Exceptions
TestoobAssertionError  

Function Summary
  assert_equals(expected, actual, msg, filter)
works like unittest.TestCase.assertEquals
  assert_matches(regex, actual, msg, filter)
fail unless regex matches actual (using re.search)
  assert_raises(exception_class, callable, *args, **kwargs)
Assert that a callable raises an exception, similar to unittest.py's assertRaises.
  assert_true(condition, msg)
  command_line(args, input, expected_output, expected_error, expected_output_regex, expected_error_regex, expected_rc, rc_predicate, skip_check)
  skip(reason)
Skip this test

Function Details

assert_equals(expected, actual, msg=None, filter=None)

works like unittest.TestCase.assertEquals

assert_matches(regex, actual, msg=None, filter=None)

fail unless regex matches actual (using re.search)

assert_raises(exception_class, callable, *args, **kwargs)

Assert that a callable raises an exception, similar to unittest.py's assertRaises.

Takes more ideas and code from recipe http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/307970

command_line(args, input=None, expected_output=None, expected_error=None, expected_output_regex=None, expected_error_regex=None, expected_rc=None, rc_predicate=None, skip_check=None)

Parameters:
skip_check - a callable that will be called with 3 parameters - output, error, and rc - before any asserts are made. If it doesn't return None, the test will skip and the callable's return value will be used as the skip reason.

skip(reason='No reason given')

Skip this test

Generated by Epydoc 2.1 on Sun Dec 3 15:27:57 2006 http://epydoc.sf.net