Package fixture

fixture is a python module for loading and referencing test data

It provides several utilities for achieving a _fixed state_ when testing 
python programs.  Specifically, these utilities setup/teardown databases and 
work with temporary file systems.  This is useful for testing and came about to 
fulfill stories like these:

  * Your test needs to load data into a database and you want to easily reference that data when making assertions.
  * You want data linked by foreign key to load automatically and delete without integrity error.
  * You want to reference linked rows by meaningful names, not hard-coded ID numbers.
  * You don't want to worry about auto-incrementing sequences.
  * You want to recreate an environment (say, for a bug) by querying a database for real data (see the `fixture` command).
  * You want to work easily with files in a temporary, transparent file system.

For more info, this concept is explained in the wikipedia article, [ Test Fixture].

===DataSet Objects===

To load data into a database (or anything suitable) you create subclasses of 
`fixture.DataSet` like so:


    >>> class BannerData(DataSet):
    ...     class free_spaceship:
    ...         text="Get a free spaceship with any purchase"
    >>> class EventData(DataSet):
    ...     class click:
    ...         name="click"
    ...         banner_id=BannerData.free_spaceship.ref('id')
    ...     class submit(click):
    ...         name="submit"
    ...     class order(click):
    ...         name="order"


_Database testing is easier than I had thought. Kumar's fixture helps provide a stable database to drive testing._ -- [ Steven F. Lott]


 * [ End User Documentation]
 * [ API Documentation]


Using the [ easy_install] command:

{{{easy_install fixture}}}

Or, if you want to create a link to the source without installing anything, cd into the root directory and type:

{{{python develop}}}

Or ... if you're old school, this works with or without [ setuptools]:

{{{python install}}}


At the moment fixture is only tested on Python 2.4 and 2.5 so it may or may not 
work with earlier versions.  If you submit a patch to support an earlier 
version, I will try my best to accommodate it.

The module does not depend on external libraries for its core functionality but 
to so something interesting you will need one of several libraries, detailed in 
the documentation.  You can also run the test suite to see what was skipped 
due to dependency error.


[ browse] the source online or [ follow these instructions] to checkout the code. 


fixture is more or less a complete rewrite of 
[ testtools.fixtures].  Since testtools went 
through several versions, fixture claims to be a 1.0 release.  All 
that means is that the implementation is now thought to be more mature and at 
any final release, a major effort will be made to preserve the interface through 
regression testing.

However, the new interface still has room to evolve and there are probably 
undiscovered bugs so please don't hesitate to 
[ submit an issue].
Module base Base Fixture components.
Package command The fixture command
Module dataset Representation of Data
Module docs fixture documentation utilities
Package examples Undocumented
Module exc Fixture exceptions
Module io Working with temporary file systems.
Package loadable Loadable fixture components
Package setup_cmd Undocumented
Module style Utilities for deriving new names from existing names.
Package test the fixture test suite.
Module util Fixture utilties.

From the module:

Function setup_test_not_supported hook for setup for the test command.
def setup_test_not_supported():
hook for setup for the test command.
API Documentation for fixture, generated by pydoctor.