changeset 658:d101b39f6c51

test_startrev: add a few assertions about clone lengths A few tweaks are added to the test to ensure that all tests pass these assertions: Some fixtures fail them by resulting in empty clones. Explicitly blacklisting such fixtures allows as to ensure that the other fixtures continue to work as expected. Other fixtures contain no files in trunk at HEAD, so we test them with other subdirectories instead.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Wed, 11 Aug 2010 19:57:34 +0200
parents 9cf547fc36e8
children 55d6697b975a
files tests/test_startrev.py
diffstat 1 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test_startrev.py
+++ b/tests/test_startrev.py
@@ -20,6 +20,11 @@ def _do_case(self, name, subdir, stupid)
     for f in fulltip:
         self.assertMultiLineEqual(fulltip[f].data(), headtip[f].data())
 
+    self.assertNotEqual(len(fullclone), 0, "full clone shouldn't be empty")
+    self.assertEqual(len(headclone), 1,
+                     "shallow clone should have just one revision, not %d"
+                     % len(headclone))
+
 def buildmethod(case, name, subdir, stupid):
     m = lambda self: self._do_case(case, subdir.strip('/'), stupid)
     m.__name__ = name
@@ -28,10 +33,28 @@ def buildmethod(case, name, subdir, stup
     return m
 
 
+# these fixtures contain no files at HEAD and would result in empty clones
+nofiles = set([
+    'binaryfiles.svndump',
+    'emptyrepo.svndump',
+])
+
+# these fixtures contain no files in trunk at HEAD and would result in an empty
+# shallow clone if cloning trunk, so we use another subdirectory
+subdirmap = {
+    'commit-to-tag.svndump': '/branches/magic',
+    'pushexternals.svndump': '',
+    'tag_name_same_as_branch.svndump': '/branches/magic',
+}
+
 attrs = {'_do_case': _do_case,
          }
+
 for case in [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')]:
-    subdir = test_util.subdir.get(case, '') + '/trunk'
+    if case in nofiles:
+        continue
+
+    subdir = test_util.subdir.get(case, '') + subdirmap.get(case, '/trunk')
 
     bname = 'test_' + case[:-len('.svndump')]
     attrs[bname] = buildmethod(case, bname, subdir, False)