From 4df1a534de967ad3399549de28da3db06b1bb4a7 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Wed, 17 Dec 2025 18:44:42 +0100 Subject: [PATCH] tests: refactor expected item_count --- src/borg/testsuite/archiver/create_cmd_test.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/borg/testsuite/archiver/create_cmd_test.py b/src/borg/testsuite/archiver/create_cmd_test.py index 4378085b2..f02beeb13 100644 --- a/src/borg/testsuite/archiver/create_cmd_test.py +++ b/src/borg/testsuite/archiver/create_cmd_test.py @@ -73,17 +73,20 @@ def test_basic_functionality(archivers, request): "input/bdev", "input/cdev", "input/dir2", - "input/dir2/file2", - "input/empty", - "input/file1", - "input/flagfile", + "input/dir2/file2", # 1 + "input/empty", # 2 + "input/file1", # 3 + "input/flagfile", # 4 + "input/fusexattr", # 5 ] + item_count = 5 # we only count regular files if are_fifos_supported(): expected.append("input/fifo1") if are_symlinks_supported(): expected.append("input/link1") if are_hardlinks_supported(): expected.append("input/hardlink") + item_count += 1 if not have_root or not has_mknod: # We could not create these device files without (fake)root. expected.remove("input/bdev") @@ -92,14 +95,13 @@ def test_basic_functionality(archivers, request): # remove the file we did not back up, so input and output become equal expected.remove("input/flagfile") # this file is UF_NODUMP os.remove(os.path.join("input", "flagfile")) - + item_count -= 1 list_output = cmd(archiver, "list", "test", "--short") for name in expected: assert name in list_output assert_dirs_equal("input", "output/input") info_output = cmd(archiver, "info", "-a", "test") - item_count = 5 if has_lchflags else 6 # one file is UF_NODUMP print("archive contents:\n%s" % list_output) assert "Number of files: %d" % item_count in info_output shutil.rmtree(archiver.cache_path)