Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/tests/conftest.py
Show All 29 Lines | |||||
# define tests profile. Full documentation is at: | # define tests profile. Full documentation is at: | ||||
# https://hypothesis.readthedocs.io/en/latest/settings.html#settings-profiles | # https://hypothesis.readthedocs.io/en/latest/settings.html#settings-profiles | ||||
settings.register_profile("fast", max_examples=5, deadline=5000) | settings.register_profile("fast", max_examples=5, deadline=5000) | ||||
settings.register_profile("slow", max_examples=20, deadline=5000) | settings.register_profile("slow", max_examples=20, deadline=5000) | ||||
@pytest.fixture | @pytest.fixture | ||||
def swh_storage(postgresql_proc, swh_storage_postgresql): | def swh_storage_backend_config(postgresql_proc, swh_storage_postgresql): | ||||
storage_config = { | yield { | ||||
'cls': 'local', | 'cls': 'local', | ||||
'db': 'postgresql://{user}@{host}:{port}/{dbname}'.format( | 'db': 'postgresql://{user}@{host}:{port}/{dbname}'.format( | ||||
host=postgresql_proc.host, | host=postgresql_proc.host, | ||||
port=postgresql_proc.port, | port=postgresql_proc.port, | ||||
user='postgres', | user='postgres', | ||||
dbname='tests'), | dbname='tests'), | ||||
'objstorage': { | 'objstorage': { | ||||
'cls': 'memory', | 'cls': 'memory', | ||||
'args': {} | 'args': {} | ||||
}, | }, | ||||
'journal_writer': { | 'journal_writer': { | ||||
'cls': 'memory', | 'cls': 'memory', | ||||
}, | }, | ||||
} | } | ||||
@pytest.fixture | |||||
def swh_storage(swh_storage_backend_config): | |||||
storage_config = { | |||||
'cls': 'validate', | |||||
'storage': swh_storage_backend_config | |||||
} | |||||
storage = swh.storage.get_storage(**storage_config) | storage = swh.storage.get_storage(**storage_config) | ||||
return storage | return storage | ||||
@pytest.fixture | @pytest.fixture | ||||
def swh_contents(swh_storage): | def swh_contents(swh_storage): | ||||
contents = gen_contents(n=20) | contents = gen_contents(n=20) | ||||
swh_storage.content_add( | swh_storage.content_add( | ||||
▲ Show 20 Lines • Show All 173 Lines • Show Last 20 Lines |