changeset 653:ab454ee515d4

test_startrev: new tests inspired by test_rebuildmeta The tests for start revision support are inspired by the rebuildmeta tests; for every single fixture, a full and a shallow clone is performed, and the two are then compared.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Tue, 20 Jul 2010 12:53:47 +0200
parents c3900ad3bf69
children e4f9603ab82a
files tests/run.py tests/test_startrev.py
diffstat 2 files changed, 51 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/run.py
+++ b/tests/run.py
@@ -22,6 +22,7 @@ def tests():
     import test_push_eol
     import test_rebuildmeta
     import test_single_dir_clone
+    import test_startrev
     import test_svnwrap
     import test_tags
     import test_utility_commands
new file mode 100644
--- /dev/null
+++ b/tests/test_startrev.py
@@ -0,0 +1,50 @@
+import test_util
+
+import os
+import unittest
+
+def _do_case(self, name, subdir, stupid):
+    wc_base = self.wc_path
+    self.wc_path = wc_base + '_full'
+    headclone = self._load_fixture_and_fetch(name, subdir=subdir, stupid=stupid,
+                                             layout='single', startrev='HEAD')
+    self.wc_path = wc_base + '_head'
+    fullclone = self._load_fixture_and_fetch(name, subdir=subdir, stupid=stupid,
+                                             layout='single')
+
+    fulltip = fullclone['tip']
+    headtip = headclone['tip']
+    # viewing diff's of lists of files is easier on the eyes
+    self.assertMultiLineEqual('\n'.join(fulltip), '\n'.join(headtip))
+
+    for f in fulltip:
+        self.assertMultiLineEqual(fulltip[f].data(), headtip[f].data())
+
+def buildmethod(case, name, subdir, stupid):
+    m = lambda self: self._do_case(case, subdir, stupid)
+    m.__name__ = name
+    m.__doc__ = ('Test clone with startrev on %s%s with %s replay.' %
+                 (case, subdir, (stupid and 'stupid') or 'real'))
+    return m
+
+
+attrs = {'_do_case': _do_case,
+         }
+for case in [f for f in os.listdir(test_util.FIXTURES) if f.endswith('.svndump')]:
+    # this fixture results in an empty repository, don't use it
+    if case == 'project_root_not_repo_root.svndump':
+        continue
+    subdir = test_util.subdir.get(case, '')
+
+    bname = 'test_' + case[:-len('.svndump')]
+    attrs[bname] = buildmethod(case, bname, subdir, False)
+    name = bname + '_stupid'
+    attrs[name] = buildmethod(case, name, subdir, True)
+
+StartRevTests = type('StartRevTests', (test_util.TestBase, ), attrs)
+
+
+def suite():
+    all = [unittest.TestLoader().loadTestsFromTestCase(StartRevTests),
+          ]
+    return unittest.TestSuite(all)