removed 'prefix'

This commit is contained in:
bigtedde 2023-07-19 17:24:15 -07:00
parent 975a094e6e
commit 0fa103460b
6 changed files with 9 additions and 11 deletions

View file

@ -93,7 +93,6 @@ class ArchiverSetup:
def __init__(self):
self.archiver = None
self.prefix = ""
self.tmpdir: Optional[str] = None
self.repository_path: Optional[str] = None
self.repository_location: Optional[str] = None
@ -111,7 +110,7 @@ def archiver(tmp_path, set_env_variables):
archiver.archiver = not archiver.FORK_DEFAULT and Archiver() or None
archiver.tmpdir = tmp_path
archiver.repository_path = os.fspath(tmp_path / "repository")
archiver.repository_location = archiver.prefix + archiver.repository_path
archiver.repository_location = archiver.repository_path
archiver.input_path = os.fspath(tmp_path / "input")
archiver.output_path = os.fspath(tmp_path / "output")
archiver.keys_path = os.fspath(tmp_path / "keys")
@ -137,8 +136,7 @@ def archiver(tmp_path, set_env_variables):
@pytest.fixture()
def remote_archiver(archiver):
archiver.prefix = "ssh://__testsuite__"
archiver.repository_location = archiver.prefix + str(archiver.repository_path)
archiver.repository_location = "ssh://__testsuite__" + str(archiver.repository_path)
yield archiver

View file

@ -281,7 +281,7 @@ def test_manifest_rebuild_duplicate_archive(archivers, request):
def test_extra_chunks(archivers, request):
archiver = request.getfixturevalue(archivers)
if archiver.prefix == "ssh://__testsuite__":
if archiver.repository_location.startswith("ssh://__testsuite__"):
pytest.skip("only works locally")
repo_location = archiver.repository_location
check_cmd_setup(archiver)
@ -330,7 +330,7 @@ def test_verify_data(archivers, request, init_args):
def test_empty_repository(archivers, request):
archiver = request.getfixturevalue(archivers)
if archiver.prefix == "ssh://__testsuite__":
if archiver.repository_location.startswith("ssh://__testsuite__"):
pytest.skip("only works locally")
repo_location = archiver.repository_location
check_cmd_setup(archiver)

View file

@ -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.prefix == "ssh://__testsuite__" else False
remote_repo = True if archiver.repository_location.startswith("ssh://__testsuite__") else False
print(cmd(archiver, f"--repo={repo_location}", "rcreate", RK_ENCRYPTION))
with Repository(repo_path, exclusive=True) as repository:

View file

@ -260,7 +260,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.prefix == "ssh://__testsuite__":
if archiver.repository_location.startswith("ssh://__testsuite__"):
pytest.skip("only works locally")
repo_location = archiver.repository_location
"""Both old_id and new_id must not be stale during lock migration / daemonization."""

View file

@ -18,10 +18,10 @@ 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
parent_path = os.path.join(archiver.tmpdir, "parent1", "parent2")
repository_path = os.path.join(parent_path, "repository")
repository_location = archiver.prefix + repository_path
repository_location = ("ssh://__testsuite__" + repository_path) if remote_repo else repository_path
with pytest.raises(Repository.ParentPathDoesNotExist):
# normal borg rcreate does NOT create missing parent dirs
cmd(archiver, f"--repo={repository_location}", "rcreate", "--encryption=none")

View file

@ -46,7 +46,7 @@ def test_transfer(archivers, request):
def test_transfer_upgrade(archivers, request):
archiver = request.getfixturevalue(archivers)
if archiver.prefix == "ssh://__testsuite__" or archiver.EXE == "borg.exe":
if archiver.repository_location.startswith("ssh://__testsuite__") or archiver.EXE == "borg.exe":
pytest.skip("only works locally")
repo_location = archiver.repository_location