Exemple #1
0
def db_type(request):
    db_list = request.config.option.test_databases
    if request.param not in db_list and 'all' not in db_list:
        pytest.skip("Skipping {} DB, set --test-all-databases=True".format(
            request.param))

    PanDB.permanently_erase_database(request.param,
                                     'panoptes_testing',
                                     really='Yes',
                                     dangerous='Totally')
    return request.param
Exemple #2
0
def db_type(request):
    db_list = request.config.option.test_databases
    if request.param not in db_list and 'all' not in db_list:  # pragma: no cover
        pytest.skip(f"Skipping {request.param} DB, set --test-all-databases=True")

    PanDB.permanently_erase_database(request.param,
                                     'panoptes_testing',
                                     storage_dir='testing',
                                     really='Yes',
                                     dangerous='Totally')
    return request.param
Exemple #3
0
def db_type(request):

    db_list = request.config.option.test_databases
    if request.param not in db_list and 'all' not in db_list:
        pytest.skip("Skipping {} DB, set --test-all-databases=True".format(request.param))

    # If testing mongo, make sure we can connect, otherwise skip.
    if request.param == 'mongo' and not can_connect_to_mongo():
        pytest.skip("Can't connect to {} DB, skipping".format(request.param))
    PanDB.permanently_erase_database(
        request.param, 'panoptes_testing', really='Yes', dangerous='Totally')
    return request.param
Exemple #4
0
def test_delete_file_db():
    with pytest.raises(Exception):
        PanDB.permanently_erase_database('memory',
                                         'panoptes_testing',
                                         really='Nope',
                                         dangerous='Hopefully not')

    with pytest.raises(ValueError):
        PanDB.permanently_erase_database('memory',
                                         'do_not_delete_me',
                                         really='Nope',
                                         dangerous='Again, we hope not')

    PanDB.permanently_erase_database('file',
                                     'panoptes_testing',
                                     storage_dir='testing',
                                     really='Yes',
                                     dangerous='Totally')
    PanDB.permanently_erase_database('memory',
                                     'panoptes_testing',
                                     dangerous='Totally',
                                     really='Yes')
Exemple #5
0
def memory_db():
    PanDB.permanently_erase_database('memory',
                                     'panoptes_testing',
                                     really='Yes',
                                     dangerous='Totally')
    return PanDB(db_type='memory', db_name='panoptes_testing')