Skip to main content

Fixture generator for fixture module

Project description

Build StatusCoverage Status

Supports only SQLAlchemy

Install

Using pip

pip install fixturegen

Or using easy_install

easy_install fixturegen

Usage

Basic

$ fixturegen-sqlalchemy mysql://user:password@localhost/your_db user
from fixture import DataSet

class UserData(DataSet):
    class user_1:
        id = 1
        name = u'first'
    class user_2:
        id = 2
        name = u'second'
    class user_3:
        id = 3
        name = u'third'

Limiting

$ fixturegen-sqlalchemy mysql://user:password@localhost/your_db user --limit=2
from fixture import DataSet

class UserData(DataSet):
    class user_1:
        id = 1
        name = u'first'
    class user_2:
        id = 2
        name = u'second'

Ordering

$ fixturegen-sqlalchemy mysql://user:password@localhost/your_db user --order-by='id DESC'
from fixture import DataSet

class UserData(DataSet):
    class user_3:
        id = 3
        name = u'third'
    class user_2:
        id = 2
        name = u'second'
    class user_1:
        id = 1
        name = u'first'

Filtering

$ fixturegen-sqlalchemy mysql://user:password@localhost/your_db user --where='id > 1'
from fixture import DataSet

class UserData(DataSet):
    class user_2:
        id = 2
        name = u'second'

Hide import statement

$ fixturegen-sqlalchemy mysql://user:password@localhost/your_db user --limit=1 --without-import
class UserData(DataSet):
    class user_1:
        id = 1
        name = u'first'

Custom fixture class name:

$ fixturegen-sqlalchemy mysql://user:password@localhost/your_db user --fixture-class-name DummyData --limit=1
class Dummy(DataSet):
    class user_1:
        id = 1
        name = u'first'

Custom row class naming:

$ fixturegen-sqlalchemy mysql://user:password@localhost/your_db user --naming-row-columns=id,name --limit=1
class Dummy(DataSet):
    class user_1_first:
        id = 1
        name = u'first'

Help

$ fixturegen-sqlalchemy --help

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
fixturegen-0.8.tar.gz (4.3 kB) Copy SHA256 hash SHA256 Source None May 9, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page