Beispiel #1
0
def pytest_sessionstart():
    from py.test import config
    from pyramid.config import Configurator
    from creme_fraiche.models import Base
    from creme_fraiche.models import insert_base
    from paste.deploy.loadwsgi import appconfig
    from sqlalchemy import engine_from_config
    import os

    ROOT_PATH = os.path.dirname(__file__)
    settings = appconfig(
        'config:' + resource_filename(
            __name__,
            'creme_fraiche/tests/test.ini'
        )
    )

    engine = engine_from_config(settings, prefix='sqlalchemy.')

    print('Creating the tables on the test database %s' % engine)

    config = Configurator(settings=settings)
    config.scan('creme_fraiche.models')

    Base.metadata.drop_all(engine)
    Base.metadata.create_all(engine)
    insert_base(engine)
Beispiel #2
0
def pytest_sessionstart():
    from py.test import config

    # Only run database setup on master (in case of xdist/multiproc mode)
    if not hasattr(config, 'slaveinput'):
        from pyramid.config         import Configurator
        from horus.tests.models     import Base
        from paste.deploy.loadwsgi  import appconfig
        from sqlalchemy             import engine_from_config

        settings = appconfig('config:' + resource_filename(__name__,
            'horus/tests/test.ini'))
        engine = engine_from_config(settings, prefix='sqlalchemy.')
        print('Creating the tables on the test database %s' % engine)
        config = Configurator(settings=settings)
        config.scan('horus.models')
        Base.metadata.drop_all(engine)
        Base.metadata.create_all(engine)
Beispiel #3
0
def pytest_sessionstart():
    from py.test import config

    # Only run database setup on master (in case of xdist/multiproc mode)
    if not hasattr(config, 'slaveinput'):
        from pyramid.config import Configurator
        from horus.tests.models import Base
        from paste.deploy.loadwsgi import appconfig
        from sqlalchemy import engine_from_config

        settings = appconfig(
            'config:' + resource_filename(__name__, 'horus/tests/test.ini'))
        engine = engine_from_config(settings, prefix='sqlalchemy.')
        print('Creating the tables on the test database %s' % engine)
        config = Configurator(settings=settings)
        config.scan('horus.models')
        Base.metadata.drop_all(engine)
        Base.metadata.create_all(engine)
Beispiel #4
0
def pytest_sessionstart():
    from py.test import config

    # Only run database setup on master (in case of xdist/multiproc mode)
    if not hasattr(config, 'slaveinput'):
        from pyramid.config import Configurator
        from pyramid_signup.models import SUEntity
        from paste.deploy.loadwsgi import appconfig
        from sqlalchemy import engine_from_config
        import os

        ROOT_PATH = os.path.dirname(__file__)
        settings = appconfig('config:' + os.path.join(ROOT_PATH, 'test.ini'))
        engine = engine_from_config(settings, prefix='sqlalchemy.')

        print 'Creating the tables on the test database %s' % engine

        config = Configurator(settings=settings)
        config.scan('pyramid_signup.models')

        SUEntity.metadata.drop_all(engine)
        SUEntity.metadata.create_all(engine)
Beispiel #5
0
def pytest_sessionstart():
    from py.test import config

    # Only run database setup on master (in case of xdist/multiproc mode)
    if not hasattr(config, 'slaveinput'):
        from pyramid.config import Configurator
        from pyramid_signup.models import Entity
        from paste.deploy.loadwsgi import appconfig
        from sqlalchemy import engine_from_config
        import os

        ROOT_PATH = os.path.dirname(__file__)
        settings = appconfig('config:' + os.path.join(ROOT_PATH, 'test.ini'))
        engine = engine_from_config(settings, prefix='sqlalchemy.')

        print 'Creating the tables on the test database %s' % engine

        config = Configurator(settings=settings)
        config.scan('pyramid_signup.models')

        Entity.metadata.drop_all(engine)
        Entity.metadata.create_all(engine)