1
Description: Make index entry tests a little bit less strict, to cope with
2
slightly different behaviour on various platforms.
3
Origin: commit, revision id: git-v1:c398d692d1ba6c5fcee26383bfc78f73875de20b
4
Author: Jelmer Vernooij <jelmer@samba.org>
5
Last-Update: 2012-04-02
6
Applied-Upstream: merged in revision 1044
7
X-Bzr-Revision-Id: git-v1:c398d692d1ba6c5fcee26383bfc78f73875de20b
9
=== modified file 'dulwich/tests/test_index.py'
10
--- old/dulwich/tests/test_index.py 2012-03-29 00:21:54 +0000
11
+++ new/dulwich/tests/test_index.py 2012-04-02 11:05:18 +0000
19
from dulwich.index import (
22
class BuildIndexTests(TestCase):
24
- def assertReasonableIndexEntry(self, index_entry,
25
- time, mode, filesize, sha):
27
- self.assertEquals(index_entry[0], index_entry[1]) # ctime and atime
28
- self.assertTrue(index_entry[0] > time - delta)
29
+ def assertReasonableIndexEntry(self, index_entry, mode, filesize, sha):
30
self.assertEquals(index_entry[4], mode) # mode
31
- if sys.platform != 'nt':
32
- self.assertEquals(index_entry[5], os.getuid())
33
- self.assertEquals(index_entry[6], os.getgid())
34
self.assertEquals(index_entry[7], filesize) # filesize
35
self.assertEquals(index_entry[8], sha) # sha
38
repo.object_store, tree.id)
40
# Verify index entries
43
index = repo.open_index()
44
self.assertEquals(len(index), 4)
47
apath = os.path.join(repo.path, 'a')
48
self.assertTrue(os.path.exists(apath))
49
self.assertReasonableIndexEntry(index['a'],
50
- ctime, stat.S_IFREG | 0644, 6, filea.id)
51
+ stat.S_IFREG | 0644, 6, filea.id)
52
self.assertFileContents(apath, 'file a')
55
bpath = os.path.join(repo.path, 'b')
56
self.assertTrue(os.path.exists(bpath))
57
self.assertReasonableIndexEntry(index['b'],
58
- ctime, stat.S_IFREG | 0644, 6, fileb.id)
59
+ stat.S_IFREG | 0644, 6, fileb.id)
60
self.assertFileContents(bpath, 'file b')
63
dpath = os.path.join(repo.path, 'c', 'd')
64
self.assertTrue(os.path.exists(dpath))
65
self.assertReasonableIndexEntry(index['c/d'],
66
- ctime, stat.S_IFREG | 0644, 6, filed.id)
67
+ stat.S_IFREG | 0644, 6, filed.id)
68
self.assertFileContents(dpath, 'file d')
71
epath = os.path.join(repo.path, 'c', 'e')
72
self.assertTrue(os.path.exists(epath))
73
self.assertReasonableIndexEntry(index['c/e'],
74
- ctime, stat.S_IFLNK, 1, filee.id)
75
+ stat.S_IFLNK, 1, filee.id)
76
self.assertFileContents(epath, 'd', symlink=True)
78
# Verify no extra files