test(backups): localfile repo by default in tests

This commit is contained in:
Houkime 2023-02-20 13:51:06 +00:00 committed by Inex Code
parent add4e21f39
commit a280e5c999
2 changed files with 11 additions and 3 deletions

View file

@ -15,9 +15,16 @@ class Backups(metaclass=SingletonMetaclass):
provider: AbstractBackupProvider
def __init__(self):
def __init__(self, test_repo_file: str = ""):
if test_repo_file != "":
self.set_localfile_repo(test_repo_file)
self.lookup_provider()
def set_localfile_repo(self, file_path: str):
ProviderClass = get_provider(BackupProvider.FILE)
provider = ProviderClass(file_path)
self.provider = provider
def lookup_provider(self):
redis_provider = Backups.load_provider_redis()
if redis_provider is not None:

View file

@ -50,8 +50,9 @@ def file_backup(tmpdir) -> AbstractBackupProvider:
@pytest.fixture()
def backups():
return Backups()
def backups(tmpdir):
test_repo_path = path.join(tmpdir, "test_repo")
return Backups(test_repo_path)
def test_select_backend():