mirror of https://github.com/borgbackup/borg.git
fix test_recreate_timestamp
it did not work in timezone utc-0800.
This commit is contained in:
parent
732ecb29fe
commit
29ae701ec9
|
@ -3195,7 +3195,6 @@ class ArchiverTestCase(ArchiverTestCaseBase):
|
||||||
assert sha256_before == sha256_after
|
assert sha256_before == sha256_after
|
||||||
|
|
||||||
def test_recreate_timestamp(self):
|
def test_recreate_timestamp(self):
|
||||||
local_timezone = datetime.now(timezone(timedelta(0))).astimezone().tzinfo
|
|
||||||
self.create_test_files()
|
self.create_test_files()
|
||||||
self.cmd(f"--repo={self.repository_location}", "rcreate", RK_ENCRYPTION)
|
self.cmd(f"--repo={self.repository_location}", "rcreate", RK_ENCRYPTION)
|
||||||
self.cmd(f"--repo={self.repository_location}", "create", "test0", "input")
|
self.cmd(f"--repo={self.repository_location}", "create", "test0", "input")
|
||||||
|
@ -3209,8 +3208,8 @@ class ArchiverTestCase(ArchiverTestCaseBase):
|
||||||
"test",
|
"test",
|
||||||
)
|
)
|
||||||
info = self.cmd(f"--repo={self.repository_location}", "info", "-a", "test0").splitlines()
|
info = self.cmd(f"--repo={self.repository_location}", "info", "-a", "test0").splitlines()
|
||||||
dtime = datetime(1970, 1, 2) + local_timezone.utcoffset(None)
|
dtime = datetime(1970, 1, 2, 0, 0, 0).astimezone() # local time in local timezone
|
||||||
s_time = dtime.strftime("%Y-%m-%d")
|
s_time = dtime.strftime("%Y-%m-%d %H:%M:.. %z").replace("+", r"\+")
|
||||||
assert any([re.search(r"Time \(start\).+ %s" % s_time, item) for item in info])
|
assert any([re.search(r"Time \(start\).+ %s" % s_time, item) for item in info])
|
||||||
assert any([re.search(r"Time \(end\).+ %s" % s_time, item) for item in info])
|
assert any([re.search(r"Time \(end\).+ %s" % s_time, item) for item in info])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue