TestFixtures 1.6.0 released!

Discussion in 'Python' started by Chris Withers, Jun 18, 2009.

  1. Hi All,

    I'm pleased to announce the first advertised release of TestFixtures.
    This is a collection of helpers and mock objects that are useful when
    writing unit tests or doc tests.

    The modules currently included are:

    *Comparison*

    This class lets you instantiate placeholders that can be used to
    compared expected results with actual results where objects in the
    actual results do not support useful comparison. The comparision can be
    based just on the type of the object or on a partial set of the object's
    attributes, both of which are particularly handy when comparing
    sequences returned from tested code.

    *compare*

    A replacement for assertEquals and the failUnless(x() is True) pattern.
    Gives more useful differences when the arguments aren't the same,
    particularly for sequences and long strings.

    *diff*

    This function will compare two strings and give a unified diff of their
    comparison. Handy as a third parameter to unittest.TestCase.assertEquals.

    *generator*

    This function will return a generator that yields the arguments it was
    called with when the generator is iterated over.

    *LogCapture*

    This helper allows you to capture log messages for specified loggers in
    doctests.

    *log_capture*

    This decorator allows you to capture log messages for specified loggers
    for the duration of unittest methods.

    *replace*

    This decorator enables you to replace objects such as classes and
    functions for the duration of a unittest method. The replacements are
    removed regardless of what happens during the test.

    *Replacer*

    This helper enables you to replace objects such as classes and functions
    from within doctests and then restore the originals once testing is
    completed.

    *should_raise*

    This is a better version of assertRaises that lets you check the
    exception raised is not only of the correct type but also has the
    correct parameters.

    *TempDirectory*

    This helper will create a temporary directory for you using mkdtemp and
    provides a handy class method for cleaning all of these up.

    *tempdir*

    This decorator will create a temporary directory for the duration of the
    unit test and clear it up no matter the outcome of the test.

    *test_date*

    This is a handy class factory that returns datetime.date replacements
    that have a today method that gives repeatable, specifiable, testable dates.

    *test_datetime*

    This is a handy class factory that returns datetime.datetime
    replacements that have a now method that gives repeatable, specifiable,
    testable datetimes.

    *test_time*

    This is a handy replacement for time.time that gives repeatable,
    specifiable, testable times.

    *wrap*

    This is a generic decorator for wrapping method and function calls with
    a try-finally and having code executed before the try and as part of the
    finally.

    To find out more, please read here:

    http://pypi.python.org/pypi/testfixtures

    cheers,

    Chris

    --
    Simplistix - Content Management, Zope & Python Consulting
    - http://www.simplistix.co.uk
     
    Chris Withers, Jun 18, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Chris Withers

    TestFixtures 1.6.1 released!

    Chris Withers, Sep 6, 2009, in forum: Python
    Replies:
    0
    Views:
    253
    Chris Withers
    Sep 6, 2009
  2. Chris Withers

    TestFixtures 1.6.2 released!

    Chris Withers, Sep 23, 2009, in forum: Python
    Replies:
    0
    Views:
    237
    Chris Withers
    Sep 23, 2009
  3. Chris Withers

    TestFixtures 1.8.0 Released!

    Chris Withers, Jan 14, 2011, in forum: Python
    Replies:
    0
    Views:
    190
    Chris Withers
    Jan 14, 2011
  4. Chris Withers

    TestFixtures 1.9.0 Released!

    Chris Withers, Feb 11, 2011, in forum: Python
    Replies:
    0
    Views:
    260
    Chris Withers
    Feb 11, 2011
  5. Chris Withers

    TestFixtures 1.9.2 Released!

    Chris Withers, Apr 20, 2011, in forum: Python
    Replies:
    0
    Views:
    255
    Chris Withers
    Apr 20, 2011
Loading...

Share This Page