~bzr/dulwich/unstable

« back to all changes in this revision

Viewing changes to debian/patches/01_less_strict_index_tests

  • Committer: Martin Packman
  • Date: 2012-08-31 18:48:09 UTC
  • mfrom: (400.39.284)
  • Revision ID: martin.packman@canonical.com-20120831184809-8ufvjlpvhxe06c2i
Merge new upstream snapshot to remove landed patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
8
 
 
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
12
 
@@ -26,7 +26,6 @@
13
 
 import shutil
14
 
 import stat
15
 
 import struct
16
 
-import sys
17
 
 import tempfile
18
 
 
19
 
 from dulwich.index import (
20
 
@@ -216,15 +215,8 @@
21
 
 
22
 
 class BuildIndexTests(TestCase):
23
 
 
24
 
-    def assertReasonableIndexEntry(self, index_entry, 
25
 
-            time, mode, filesize, sha):
26
 
-        delta = 1000000
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
36
 
 
37
 
@@ -283,8 +275,6 @@
38
 
                 repo.object_store, tree.id)
39
 
 
40
 
         # Verify index entries
41
 
-        import time
42
 
-        ctime = time.time()
43
 
         index = repo.open_index()
44
 
         self.assertEquals(len(index), 4)
45
 
 
46
 
@@ -292,28 +282,28 @@
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')
53
 
 
54
 
         # fileb
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')
61
 
 
62
 
         # filed
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')
69
 
 
70
 
         # symlink to 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)
77
 
 
78
 
         # Verify no extra files
79