summaryrefslogtreecommitdiff
path: root/morphlib/bins_tests.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-02-28 14:02:38 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-02-28 14:02:38 +0000
commit91277aca4a23df6adae864314f8d210122a5fd6e (patch)
tree1d8ed3d452eeccc6399538e78ee4a7699f8268e3 /morphlib/bins_tests.py
parenta6e821c0aef8396f87f309e3dfa61a9ea931ec50 (diff)
downloadmorph-91277aca4a23df6adae864314f8d210122a5fd6e.tar.gz
Document why test ignore directory size and mtime
Diffstat (limited to 'morphlib/bins_tests.py')
-rw-r--r--morphlib/bins_tests.py11
1 files changed, 11 insertions, 0 deletions
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: