diff --git a/src/borg/testsuite/archiver/extract_cmd_test.py b/src/borg/testsuite/archiver/extract_cmd_test.py index cd8f5d070..79c27214d 100644 --- a/src/borg/testsuite/archiver/extract_cmd_test.py +++ b/src/borg/testsuite/archiver/extract_cmd_test.py @@ -204,11 +204,11 @@ def test_sparse_file(archivers, request): sparse = False return sparse - filename = os.path.join(archiver.input_path, "sparse") + filename_in = os.path.join(archiver.input_path, "sparse") content = b"foobar" hole_size = 5 * (1 << CHUNK_MAX_EXP) # 5 full chunker buffers total_size = hole_size + len(content) + hole_size - with open(filename, "wb") as fd: + with open(filename_in, "wb") as fd: # create a file that has a hole at the beginning and end (if the # OS and filesystem supports sparse files) fd.seek(hole_size, 1) @@ -217,7 +217,7 @@ def test_sparse_file(archivers, request): pos = fd.tell() fd.truncate(pos) # we first check if we could create a sparse input file: - sparse_support = is_sparse(filename, total_size, hole_size) + sparse_support = is_sparse(filename_in, total_size, hole_size) if sparse_support: # we could create a sparse input file, so creating a backup of it and # extracting it again (as sparse) should also work: @@ -226,13 +226,15 @@ def test_sparse_file(archivers, request): with changedir(archiver.output_path): cmd(archiver, "extract", "test", "--sparse") assert_dirs_equal("input", "output/input") - filename = os.path.join(archiver.output_path, "input", "sparse") - with open(filename, "rb") as fd: + filename_out = os.path.join(archiver.output_path, "input", "sparse") + with open(filename_out, "rb") as fd: # check if file contents are as expected assert fd.read(hole_size) == b"\0" * hole_size assert fd.read(len(content)) == content assert fd.read(hole_size) == b"\0" * hole_size - assert is_sparse(filename, total_size, hole_size) + assert is_sparse(filename_out, total_size, hole_size) + os.unlink(filename_out) # save space on TMPDIR + os.unlink(filename_in) # save space on TMPDIR def test_unusual_filenames(archivers, request): diff --git a/src/borg/testsuite/archiver/list_cmd_test.py b/src/borg/testsuite/archiver/list_cmd_test.py index ba7538867..33026a399 100644 --- a/src/borg/testsuite/archiver/list_cmd_test.py +++ b/src/borg/testsuite/archiver/list_cmd_test.py @@ -35,11 +35,13 @@ def test_list_chunk_counts(archivers, request): archiver = request.getfixturevalue(archivers) create_regular_file(archiver.input_path, "empty_file", size=0) create_regular_file(archiver.input_path, "two_chunks") - with open(os.path.join(archiver.input_path, "two_chunks"), "wb") as fd: + filename = os.path.join(archiver.input_path, "two_chunks") + with open(filename, "wb") as fd: fd.write(b"abba" * 2000000) fd.write(b"baab" * 2000000) cmd(archiver, "repo-create", RK_ENCRYPTION) cmd(archiver, "create", "test", "input") + os.unlink(filename) # save space on TMPDIR output = cmd(archiver, "list", "test", "--format", "{num_chunks} {path}{NL}") assert "0 input/empty_file" in output assert "2 input/two_chunks" in output diff --git a/src/borg/testsuite/archiver/repo_space_cmd_test.py b/src/borg/testsuite/archiver/repo_space_cmd_test.py index e21e5c786..83498cb88 100644 --- a/src/borg/testsuite/archiver/repo_space_cmd_test.py +++ b/src/borg/testsuite/archiver/repo_space_cmd_test.py @@ -54,6 +54,8 @@ def test_repo_space_modify_reservation(archivers, request): # note: --reserve can only INCREASE the amount of reserved space. + cmd(archiver, "repo-space", "--free") # save space on TMPDIR + def test_repo_space_edge_cases(archivers, request): archiver = request.getfixturevalue(archivers) @@ -78,3 +80,5 @@ def test_repo_space_edge_cases(archivers, request): # Check that space is reserved (should be 64MiB). output = cmd(archiver, "repo-space") assert "There is 67.11 MB reserved space in this repository." in output + + cmd(archiver, "repo-space", "--free") # save space on TMPDIR diff --git a/src/borg/testsuite/archiver/transfer_cmd_test.py b/src/borg/testsuite/archiver/transfer_cmd_test.py index da1055d55..7ac3df4bd 100644 --- a/src/borg/testsuite/archiver/transfer_cmd_test.py +++ b/src/borg/testsuite/archiver/transfer_cmd_test.py @@ -412,7 +412,7 @@ def test_transfer_rechunk(archivers, request, monkeypatch): """Test transfer with re-chunking""" archiver = request.getfixturevalue(archivers) - BLKSIZE = 4096 + BLKSIZE = 512 source_chunker_params = "buzhash,19,23,21,4095" # default buzhash chunks dest_chunker_params = f"fixed,{BLKSIZE}" # fixed chunk size diff --git a/src/borg/testsuite/legacyrepository_test.py b/src/borg/testsuite/legacyrepository_test.py index 7a056cc7d..c575e1e5e 100644 --- a/src/borg/testsuite/legacyrepository_test.py +++ b/src/borg/testsuite/legacyrepository_test.py @@ -229,6 +229,7 @@ def test_max_data_size(repo_fixtures, request): assert pdchunk(repository.get(H(0))) == max_data with pytest.raises(IntegrityError): repository.put(H(1), fchunk(max_data + b"x")) + repository.delete(H(0)) def _assert_sparse(repository): diff --git a/src/borg/testsuite/repository_test.py b/src/borg/testsuite/repository_test.py index e58b062d5..aaee455e5 100644 --- a/src/borg/testsuite/repository_test.py +++ b/src/borg/testsuite/repository_test.py @@ -143,6 +143,7 @@ def test_max_data_size(repo_fixtures, request): assert pdchunk(repository.get(H(0))) == max_data with pytest.raises(IntegrityError): repository.put(H(1), fchunk(max_data + b"x")) + repository.delete(H(0)) def check(repository, repo_path, repair=False, status=True):