Skip to content

Commit 3c5b695

Browse files
committed
test that add_file_from_memory does set timestamps
1 parent b2c8768 commit 3c5b695

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tests/test_rwx.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import json
77

88
import libarchive
9+
from libarchive.entry import format_time
910
from libarchive.extract import EXTRACT_OWNER, EXTRACT_PERM, EXTRACT_TIME
1011
from libarchive.write import memory_writer
1112
from mock import patch
@@ -156,3 +157,10 @@ def write_callback(data):
156157
actual = b''.join(archive_entry.get_blocks())
157158
assert expected == actual
158159
assert archive_entry.path == entry_path
160+
assert archive_entry.atime in (atime[0], format_time(*atime))
161+
assert archive_entry.mtime in (mtime[0], format_time(*mtime))
162+
assert archive_entry.ctime in (ctime[0], format_time(*ctime))
163+
if has_birthtime:
164+
assert archive_entry.birthtime in (
165+
btime[0], format_time(*btime)
166+
)

0 commit comments

Comments
 (0)