'postgresql93',
))
def test_postgresql_proc(request, postgres):
    postgresql_proc = request.getfuncargvalue(postgres)
    assert postgresql_proc.running() is True


def test_main_postgres(postgresql):
    cur = postgresql.cursor()
    cur.execute(query)
    postgresql.commit()
    cur.close()


postgresql_proc2 = factories.postgresql_proc(port=9876)
postgresql2 = factories.postgresql('postgresql_proc2')


def test_two_postgreses(postgresql, postgresql2):
    cur = postgresql.cursor()
    cur.execute(query)
    postgresql.commit()
    cur.close()

    cur = postgresql2.cursor()
    cur.execute(query)
    postgresql2.commit()
    cur.close()


postgresql_rand_proc = factories.postgresql_proc(port='?')
Ejemplo n.º 2
0
    'postgresql91',
    'postgresql92',
    'postgresql93',
))
def test_postgresql_proc(request, postgres):
    postgresql_proc = request.getfuncargvalue(postgres)
    assert postgresql_proc.running() is True


def test_main_postgres(postgresql):
    cur = postgresql.cursor()
    cur.execute(query)
    postgresql.commit()
    cur.close()


postgresql_proc2 = factories.postgresql_proc(port=9876)
postgresql2 = factories.postgresql('postgresql_proc2', port=9876)


def test_two_postgreses(postgresql, postgresql2):
    cur = postgresql.cursor()
    cur.execute(query)
    postgresql.commit()
    cur.close()

    cur = postgresql2.cursor()
    cur.execute(query)
    postgresql2.commit()
    cur.close()
Ejemplo n.º 3
0
            'argument passed to --dbfixtures-config is not a valid file path')
    redis_conf = early_config.getvalue('redis_conf')
    if redis_conf and not path(redis_conf).isfile():
        raise ValueError(
            'argument passed to --redis-config is not a valid file path')
    rabbit_conf = early_config.getvalue('rabbit_conf')
    if rabbit_conf and not path(rabbit_conf).isfile():
        raise ValueError(
            'argument passed to --rabbit-config is not a valid file path')


redis_proc = factories.redis_proc()
redisdb = factories.redisdb('redis_proc')

postgresql_proc = factories.postgresql_proc()
postgresql = factories.postgresql('postgresql_proc')

mysql_proc = factories.mysql_proc()
mysql = factories.mysql('mysql_proc')


@pytest.fixture
def mysqldb(mysql):
    warnings.warn(
        '`mysqldb` fixture is deprecated. Please use `mysql` instead.',
        DeprecationWarning, 2)
    return mysql


elasticsearch_proc = factories.elasticsearch_proc()
elasticsearch = factories.elasticsearch('elasticsearch_proc')
Ejemplo n.º 4
0
from leaflets.app import setup_app
from leaflets.views import BaseHandler  # noqa
from leaflets.models import User, Address, CampaignAddress, Campaign
from leaflets.etc import options
from leaflets.dev import add_users
from leaflets import database as db

options.DB_USER = '******'
options.DB_PASSWORD = None
options.DB_PORT = 15533
options.DB_HOST = '127.0.0.1'

postgres_proc = factories.postgresql_proc(
        executable=options.POSTGRES_LOCATION + '9.3/bin/pg_ctl', port=options.DB_PORT,
)
postgresdb = factories.postgresql('postgres_proc', db=options.DB_NAME)


@pytest.yield_fixture
def database(postgresdb):
    """Set up the database."""
    alembic_ini = '../tests/test_alembic.ini'
    alembic_cfg = Config(alembic_ini)

    with (Path(__file__).parent.parent / 'leaflets'):
        alembic_command.upgrade(alembic_cfg, "head")

    yield postgresdb

    db.session.close_all()
    db.engine.dispose()
Ejemplo n.º 5
0
    if redis_conf and not path(redis_conf).isfile():
        raise ValueError(
            'argument passed to --redis-config is not a valid file path'
        )
    rabbit_conf = early_config.getvalue('rabbit_conf')
    if rabbit_conf and not path(rabbit_conf).isfile():
        raise ValueError(
            'argument passed to --rabbit-config is not a valid file path'
        )


redis_proc = factories.redis_proc()
redisdb = factories.redisdb('redis_proc')

postgresql_proc = factories.postgresql_proc()
postgresql = factories.postgresql('postgresql_proc')

mysql_proc = factories.mysql_proc()
mysql = factories.mysql('mysql_proc')


@pytest.fixture
def mysqldb(mysql):
    warnings.warn(
        '`mysqldb` fixture is deprecated. Please use `mysql` instead.',
        DeprecationWarning,
        2
    )
    return mysql

elasticsearch_proc = factories.elasticsearch_proc()
from pytest_dbfixtures import factories
from tempfile import NamedTemporaryFile
import os
import pytest
import re
import subprocess

from abridger.abridge_db import main
from abridger.database.sqlite import SqliteDatabase
from test.abridge_db_test_utils import TestAbridgeDbBase
from test.conftest import got_postgresql
from test.fixtures.postgresql import make_postgresql_database

postgresql_proc2 = factories.postgresql_proc(port=5434)
postgresql2 = factories.postgresql('postgresql_proc2')


@pytest.mark.skipif(not got_postgresql(), reason='Needs postgresql')
class TestAbridgeDbForPostgresql(TestAbridgeDbBase):
    def setup_method(self, method):
        self.src_database = None
        self.dst_database = None

    def teardown_method(self, method):
        # Belt and braces in case something unexpected fails
        if self.src_database is not None:
            self.src_database.disconnect
        if self.dst_database is not None:
            self.dst_database.disconnect

    def prepare_src(self, postgresql):
Ejemplo n.º 7
0

@pytest.mark.parametrize('postgres',
                         ('postgresql91', 'postgresql92', 'postgresql93',))
def test_postgresql_proc(request, postgres):
    postgresql_proc = request.getfuncargvalue(postgres)
    assert postgresql_proc.running() is True


def test_main_postgres(postgresql):
    cur = postgresql.cursor()
    cur.execute(query)
    postgresql.commit()
    cur.close()


postgresql_proc2 = factories.postgresql_proc(port=9876)
postgresql2 = factories.postgresql('postgresql_proc2', port=9876)


def test_two_postgreses(postgresql, postgresql2):
    cur = postgresql.cursor()
    cur.execute(query)
    postgresql.commit()
    cur.close()

    cur = postgresql2.cursor()
    cur.execute(query)
    postgresql2.commit()
    cur.close()
from pytest_dbfixtures import factories
from tempfile import NamedTemporaryFile
import os
import pytest
import re
import subprocess

from abridger.abridge_db import main
from abridger.database.sqlite import SqliteDatabase
from test.abridge_db_test_utils import TestAbridgeDbBase
from test.conftest import got_postgresql
from test.fixtures.postgresql import make_postgresql_database


postgresql_proc2 = factories.postgresql_proc(port=5434)
postgresql2 = factories.postgresql('postgresql_proc2')


@pytest.mark.skipif(not got_postgresql(), reason='Needs postgresql')
class TestAbridgeDbForPostgresql(TestAbridgeDbBase):
    def setup_method(self, method):
        self.src_database = None
        self.dst_database = None

    def teardown_method(self, method):
        # Belt and braces in case something unexpected fails
        if self.src_database is not None:
            self.src_database.disconnect
        if self.dst_database is not None:
            self.dst_database.disconnect
    'postgresql93',
))
def test_postgresql_proc(request, postgres):
    postgresql_proc = request.getfuncargvalue(postgres)
    assert postgresql_proc.running() is True


def test_main_postgres(postgresql):
    cur = postgresql.cursor()
    cur.execute(query)
    postgresql.commit()
    cur.close()


postgresql_proc2 = factories.postgresql_proc(port=9876)
postgresql2 = factories.postgresql('postgresql_proc2')


def test_two_postgreses(postgresql, postgresql2):
    cur = postgresql.cursor()
    cur.execute(query)
    postgresql.commit()
    cur.close()

    cur = postgresql2.cursor()
    cur.execute(query)
    postgresql2.commit()
    cur.close()


postgresql_rand_proc = factories.postgresql_proc(port='?')