From 6e8310346ee36e3818108f6530a9107f865f59a7 Mon Sep 17 00:00:00 2001 From: Michael Deyaso Date: Fri, 24 Mar 2023 09:01:42 +0300 Subject: [PATCH] Forward port of #7471. Fixes #7470 --- src/borg/testsuite/archiver/diff_cmd.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/borg/testsuite/archiver/diff_cmd.py b/src/borg/testsuite/archiver/diff_cmd.py index 8689bb019..950b3e17c 100644 --- a/src/borg/testsuite/archiver/diff_cmd.py +++ b/src/borg/testsuite/archiver/diff_cmd.py @@ -6,7 +6,7 @@ from ...constants import * # NOQA from .. import are_symlinks_supported, are_hardlinks_supported -from ..platform import is_win32 +from ..platform import is_win32, is_darwin from . import ArchiverTestCaseBase, RemoteArchiverTestCaseBase, ArchiverTestCaseBinaryBase, RK_ENCRYPTION, BORG_EXES @@ -247,12 +247,16 @@ def test_time_diffs(self): if is_win32: # Sleeping for 15s because Windows doesn't refresh ctime if file is deleted and recreated within 15 seconds. time.sleep(15) + elif is_darwin: + time.sleep(1) # HFS has a 1s timestamp granularity self.create_regular_file("test_file", size=15) self.cmd(f"--repo={self.repository_location}", "create", "archive2", "input") output = self.cmd(f"--repo={self.repository_location}", "diff", "archive1", "archive2") self.assert_in("mtime", output) self.assert_in("ctime", output) # Should show up on windows as well since it is a new file. - os.chmod("input/test_file", 777) + if is_darwin: + time.sleep(1) # HFS has a 1s timestamp granularity + os.chmod("input/test_file", 0o777) self.cmd(f"--repo={self.repository_location}", "create", "archive3", "input") output = self.cmd(f"--repo={self.repository_location}", "diff", "archive2", "archive3") self.assert_not_in("mtime", output)