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.

Files for fixturegen, version 0.8
Filename, size File type Python version Upload date Hashes
Filename, size fixturegen-0.8.tar.gz (4.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page