Mercurial > hgsubversion
comparison tests/test_utility_commands.py @ 1077:8f3a241b790d
test_utility_commands: use stupid mode metaclass
| author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
|---|---|
| date | Fri, 09 Aug 2013 23:46:02 +0200 |
| parents | d741f536f23a |
| children | cd0d14e25757 |
comparison
equal
deleted
inserted
replaced
| 1076:58b2d84df5e7 | 1077:8f3a241b790d |
|---|---|
| 29 | 29 |
| 30 def repourl(repo_path): | 30 def repourl(repo_path): |
| 31 return util.normalize_url(test_util.fileurl(repo_path)) | 31 return util.normalize_url(test_util.fileurl(repo_path)) |
| 32 | 32 |
| 33 class UtilityTests(test_util.TestBase): | 33 class UtilityTests(test_util.TestBase): |
| 34 stupid_mode_tests = True | |
| 35 | |
| 34 def test_info_output(self): | 36 def test_info_output(self): |
| 35 repo, repo_path = self.load_and_fetch('two_heads.svndump') | 37 repo, repo_path = self.load_and_fetch('two_heads.svndump') |
| 36 hg.update(self.repo, 'the_branch') | 38 hg.update(self.repo, 'the_branch') |
| 37 u = self.ui() | 39 u = self.ui() |
| 38 u.pushbuffer() | 40 u.pushbuffer() |
| 264 svncommands.listauthors(self.ui(), | 266 svncommands.listauthors(self.ui(), |
| 265 args=[test_util.fileurl(repo_path)], | 267 args=[test_util.fileurl(repo_path)], |
| 266 authors=author_path) | 268 authors=author_path) |
| 267 self.assertMultiLineEqual(open(author_path).read(), 'Augie=\nevil=\n') | 269 self.assertMultiLineEqual(open(author_path).read(), 'Augie=\nevil=\n') |
| 268 | 270 |
| 269 def test_svnverify(self, stupid=False): | 271 def test_svnverify(self): |
| 270 repo, repo_path = self.load_and_fetch('binaryfiles.svndump', | 272 repo, repo_path = self.load_and_fetch('binaryfiles.svndump', |
| 271 noupdate=False, stupid=stupid) | 273 noupdate=False) |
| 272 ret = verify.verify(self.ui(), repo, [], rev=1, stupid=stupid) | 274 ret = verify.verify(self.ui(), repo, [], rev=1) |
| 273 self.assertEqual(0, ret) | 275 self.assertEqual(0, ret) |
| 274 repo_path = self.load_svndump('binaryfiles-broken.svndump') | 276 repo_path = self.load_svndump('binaryfiles-broken.svndump') |
| 275 u = self.ui() | 277 u = self.ui() |
| 276 u.pushbuffer() | 278 u.pushbuffer() |
| 277 ret = verify.verify(u, repo, [test_util.fileurl(repo_path)], | 279 ret = verify.verify(u, repo, [test_util.fileurl(repo_path)], |
| 278 rev=1, stupid=stupid) | 280 rev=1) |
| 279 output = u.popbuffer() | 281 output = u.popbuffer() |
| 280 self.assertEqual(1, ret) | 282 self.assertEqual(1, ret) |
| 281 output = re.sub(r'file://\S+', 'file://', output) | 283 output = re.sub(r'file://\S+', 'file://', output) |
| 282 self.assertMultiLineEqual("""\ | 284 self.assertMultiLineEqual("""\ |
| 283 verifying d51f46a715a1 against file:// | 285 verifying d51f46a715a1 against file:// |
| 284 difference in: binary2 | 286 difference in: binary2 |
| 285 unexpected file: binary1 | 287 unexpected file: binary1 |
| 286 missing file: binary3 | 288 missing file: binary3 |
| 287 """, output) | 289 """, output) |
| 288 | 290 |
| 289 def test_svnverify_stupid(self): | 291 def test_corruption(self): |
| 290 self.test_svnverify(True) | |
| 291 | |
| 292 def test_corruption(self, stupid=False): | |
| 293 SUCCESS = 0 | 292 SUCCESS = 0 |
| 294 FAILURE = 1 | 293 FAILURE = 1 |
| 295 | 294 |
| 296 repo, repo_path = self.load_and_fetch('correct.svndump', layout='single', | 295 repo, repo_path = self.load_and_fetch('correct.svndump', layout='single', |
| 297 subdir='', stupid=stupid) | 296 subdir='') |
| 298 | 297 |
| 299 ui = self.ui() | 298 ui = self.ui() |
| 300 | 299 |
| 301 self.assertEqual(SUCCESS, verify.verify(ui, self.repo, rev='tip', | 300 self.assertEqual(SUCCESS, verify.verify(ui, self.repo, rev='tip')) |
| 302 stupid=stupid)) | |
| 303 | 301 |
| 304 corrupt_source = test_util.fileurl(self.load_svndump('corrupt.svndump')) | 302 corrupt_source = test_util.fileurl(self.load_svndump('corrupt.svndump')) |
| 305 | 303 |
| 306 repo.ui.setconfig('paths', 'default', corrupt_source) | 304 repo.ui.setconfig('paths', 'default', corrupt_source) |
| 307 | 305 |
| 323 'unexpected file: empty-file', | 321 'unexpected file: empty-file', |
| 324 ]) | 322 ]) |
| 325 | 323 |
| 326 self.assertEqual((FAILURE, expected), (code, actual)) | 324 self.assertEqual((FAILURE, expected), (code, actual)) |
| 327 | 325 |
| 328 def test_corruption_stupid(self): | |
| 329 self.test_corruption(True) | |
| 330 | |
| 331 def test_svnrebuildmeta(self): | 326 def test_svnrebuildmeta(self): |
| 332 otherpath = self.load_svndump('binaryfiles-broken.svndump') | 327 otherpath = self.load_svndump('binaryfiles-broken.svndump') |
| 333 otherurl = test_util.fileurl(otherpath) | 328 otherurl = test_util.fileurl(otherpath) |
| 334 self.load_and_fetch('replace_trunk_with_branch.svndump') | 329 self.load_and_fetch('replace_trunk_with_branch.svndump') |
| 335 # rebuildmeta with original repo | 330 # rebuildmeta with original repo |
