

@pytest.fixture(scope='session')
def database(request):
    config = get_config(request)
    pg_host = config.postgresql.host
    pg_port = config.postgresql.port
    pg_user = config.postgresql.user
    pg_db = config.postgresql.db
    init_postgresql_database(psycopg2, pg_user, pg_host, pg_port, pg_db)

    @request.addfinalizer
    def drop_database():
        drop_postgresql_database(psycopg2, pg_user, pg_host, pg_port, pg_db)
    return 'postgresql://{}@{}:{}/{}'.format(pg_user, pg_host, pg_port, pg_db)

dataset/ETHPy150Open pypa/warehouse/tests/conftest.py database/original