Esempio n. 1
0
def tables_and_data():
    config = get_config(['-c', TEST_CONFIG_PATH.as_posix()])
    cb_conf = config['couchbase']

    create_index(cb_conf)
    data = sample_data(cb_conf)
    yield data
    drop_index(cb_conf)
Esempio n. 2
0
def tables_and_data():
    create_tables()
    sample_data()
    yield
    drop_tables()
Esempio n. 3
0
import psycopg2
from project.settings import config
from init_db import create_tables, create_engine, sample_data

DSN = "postgresql://{user}:{password}@{host}:{port}/{database}".format(**config['postgres'])
try:
    conn = psycopg2.connect(DSN)
    conn.close()
    try:
        engine = create_engine(DSN)
        create_tables(engine)
        sample_data(engine)
    except:
        pass
except psycopg2.OperationalError:
    raise
Esempio n. 4
0
def sample_data_fixture():
    create_tables()
    sample = sample_data()
    yield sample
    drop_tables()