mirror of https://github.com/borgbackup/borg.git
get_kind added to ArchiverSetup
This commit is contained in:
parent
683bf7275a
commit
b8b80c5fef
|
@ -103,6 +103,14 @@ class ArchiverSetup:
|
|||
self.exclude_file_path: Optional[str] = None
|
||||
self.patterns_file_path: Optional[str] = None
|
||||
|
||||
def get_kind(self) -> str:
|
||||
if self.repository_location.startswith("ssh://__testsuite__"):
|
||||
return "remote"
|
||||
elif self.EXE == "borg.exe":
|
||||
return "binary"
|
||||
else:
|
||||
return "local"
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def archiver(tmp_path, set_env_variables):
|
||||
|
|
|
@ -176,7 +176,7 @@ def open_archive(repo_path, name):
|
|||
|
||||
|
||||
def open_repository(archiver):
|
||||
if archiver.repository_location.startswith("ssh://__testsuite__"):
|
||||
if archiver.get_kind() == "remote":
|
||||
return RemoteRepository(Location(archiver.repository_location))
|
||||
else:
|
||||
return Repository(archiver.repository_path, exclusive=True)
|
||||
|
|
|
@ -280,7 +280,7 @@ def test_manifest_rebuild_duplicate_archive(archivers, request):
|
|||
|
||||
def test_extra_chunks(archivers, request):
|
||||
archiver = request.getfixturevalue(archivers)
|
||||
if archiver.repository_location.startswith("ssh://__testsuite__"):
|
||||
if archiver.get_kind() == "remote":
|
||||
pytest.skip("only works locally")
|
||||
repo_location = archiver.repository_location
|
||||
check_cmd_setup(archiver)
|
||||
|
@ -329,7 +329,7 @@ def test_verify_data(archivers, request, init_args):
|
|||
|
||||
def test_empty_repository(archivers, request):
|
||||
archiver = request.getfixturevalue(archivers)
|
||||
if archiver.repository_location.startswith("ssh://__testsuite__"):
|
||||
if archiver.get_kind() == "remote":
|
||||
pytest.skip("only works locally")
|
||||
repo_location = archiver.repository_location
|
||||
check_cmd_setup(archiver)
|
||||
|
|
|
@ -275,7 +275,7 @@ def test_unknown_feature_on_mount(archivers, request):
|
|||
def test_unknown_mandatory_feature_in_cache(archivers, request):
|
||||
archiver = request.getfixturevalue(archivers)
|
||||
repo_location, repo_path = archiver.repository_location, archiver.repository_path
|
||||
remote_repo = True if archiver.repository_location.startswith("ssh://__testsuite__") else False
|
||||
remote_repo = True if archiver.get_kind() == "remote" else False
|
||||
print(cmd(archiver, f"--repo={repo_location}", "rcreate", RK_ENCRYPTION))
|
||||
|
||||
with Repository(repo_path, exclusive=True) as repository:
|
||||
|
|
|
@ -259,7 +259,7 @@ def test_fuse_mount_options(archivers, request):
|
|||
@pytest.mark.skipif(not llfuse, reason="llfuse not installed")
|
||||
def test_migrate_lock_alive(archivers, request):
|
||||
archiver = request.getfixturevalue(archivers)
|
||||
if archiver.repository_location.startswith("ssh://__testsuite__"):
|
||||
if archiver.get_kind() == "remote":
|
||||
pytest.skip("only works locally")
|
||||
repo_location = archiver.repository_location
|
||||
"""Both old_id and new_id must not be stale during lock migration / daemonization."""
|
||||
|
|
|
@ -17,7 +17,7 @@ def test_rcreate_parent_dirs(archivers, request):
|
|||
archiver = request.getfixturevalue(archivers)
|
||||
if archiver.EXE:
|
||||
pytest.skip("does not raise Exception, but sets rc==2")
|
||||
remote_repo = True if archiver.repository_location.startswith("ssh://__testsuite__") else False
|
||||
remote_repo = True if archiver.get_kind() == "remote" else False
|
||||
parent_path = os.path.join(archiver.tmpdir, "parent1", "parent2")
|
||||
repository_path = os.path.join(parent_path, "repository")
|
||||
repository_location = ("ssh://__testsuite__" + repository_path) if remote_repo else repository_path
|
||||
|
|
|
@ -45,7 +45,7 @@ def test_transfer(archivers, request):
|
|||
|
||||
def test_transfer_upgrade(archivers, request):
|
||||
archiver = request.getfixturevalue(archivers)
|
||||
if archiver.repository_location.startswith("ssh://__testsuite__") or archiver.EXE == "borg.exe":
|
||||
if archiver.get_kind() in ["remote", "binary"]:
|
||||
pytest.skip("only works locally")
|
||||
repo_location = archiver.repository_location
|
||||
|
||||
|
|
Loading…
Reference in New Issue