From 10b7533d0c2d1a350bf7fa6fdf5d4be973155170 Mon Sep 17 00:00:00 2001 From: Volker Birk Date: Sat, 23 Mar 2019 12:17:43 +0100 Subject: [PATCH] print nice and sorted by time --- test/sync_handshake.py | 2 +- test/sync_test.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/sync_handshake.py b/test/sync_handshake.py index b1f8e2b..13c07e1 100644 --- a/test/sync_handshake.py +++ b/test/sync_handshake.py @@ -50,7 +50,7 @@ def print_msg(p): with open(p, "r") as f: t = f.read(-1) msg = pEp.Message(t) - print("\n" + colored(str(p), color)) + print("\n" + colored(p.name, color)) print(datetime.fromtimestamp(p.stat().st_mtime)) m = re.search("(.*)", msg.opt_fields["pEp.sync"]) print(m.group(1)) diff --git a/test/sync_test.py b/test/sync_test.py index 96f01db..4c3f94b 100644 --- a/test/sync_test.py +++ b/test/sync_test.py @@ -122,7 +122,9 @@ if __name__ == "__main__": from sync_handshake import print_msg inbox = pathlib.Path("TestInbox") - for p in reversed([ path for path in inbox.glob("*.eml") ]): + l = [ path for path in inbox.glob("*.eml") ] + l.sort(key=(lambda p: p.stat().st_mtime)) + for p in l: print_msg(p) else: