From 91277aca4a23df6adae864314f8d210122a5fd6e Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 28 Feb 2012 14:02:38 +0000 Subject: Document why test ignore directory size and mtime --- morphlib/bins_tests.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'morphlib') diff --git a/morphlib/bins_tests.py b/morphlib/bins_tests.py index 90c8cc0a..9139481b 100644 --- a/morphlib/bins_tests.py +++ b/morphlib/bins_tests.py @@ -42,6 +42,17 @@ class BinsTest(unittest.TestCase): def lstat(filename): st = os.lstat(filename) + + # For directories, the size is dependent on the contents, and + # possibly on things that have been deleted already. An unpacked + # directory can be identical even if the size field is different. + # So we ignore it for directories. + # + # Similarly, the mtime for a directory will change when we remove + # files in the directory, and a different mtime is not necessarily + # a sign of a bad unpack. It's possible for the tests to arrange + # for everything to be correct as far as directory mtimes are + # concerned, but it's not worth it, so we fudge the mtime too. if stat.S_ISDIR(st.st_mode): return (st.st_mode, 0, 0) else: -- cgit v1.2.1