comparison tests/test_template_keywords.py @ 723:4baa41e0f8ad

revset tests: use requiresmodule decorator
author Augie Fackler <durin42@gmail.com>
date Tue, 05 Oct 2010 17:30:01 -0500
parents aa24148a7454
children e9af7eba88db
comparison
equal deleted inserted replaced
722:aa24148a7454 723:4baa41e0f8ad
47 self.assertEqual(ui._output, 47 self.assertEqual(ui._output,
48 ('0:df2126f7-00ab-4d49-b42c-7e981dde0bcf ' 48 ('0:df2126f7-00ab-4d49-b42c-7e981dde0bcf '
49 '1:df2126f7-00ab-4d49-b42c-7e981dde0bcf ' 49 '1:df2126f7-00ab-4d49-b42c-7e981dde0bcf '
50 '2: ')) 50 '2: '))
51 51
52 if templatekw and revset: 52 @test_util.requiresmodule(revset)
53 def test_svn_revsets(self): 53 @test_util.requiresmodule(templatekw)
54 repo = self._load_fixture_and_fetch('two_revs.svndump') 54 def test_svn_revsets(self):
55 repo = self._load_fixture_and_fetch('two_revs.svndump')
55 56
56 # we want one commit that isn't from Subversion 57 # we want one commit that isn't from Subversion
57 self.commitchanges([('foo', 'foo', 'frobnicate\n')]) 58 self.commitchanges([('foo', 'foo', 'frobnicate\n')])
58 59
59 defaults = {'date': None, 'rev': ['fromsvn()'], 'user': None} 60 defaults = {'date': None, 'rev': ['fromsvn()'], 'user': None}
60 61
61 ui = CapturingUI() 62 ui = CapturingUI()
62 commands.log(ui, repo, template='{rev}:{svnrev} ', **defaults) 63 commands.log(ui, repo, template='{rev}:{svnrev} ', **defaults)
63 self.assertEqual(ui._output, '0:2 1:3 ') 64 self.assertEqual(ui._output, '0:2 1:3 ')
64 65
65 defaults = {'date': None, 'rev': ['svnrev(2)'], 'user': None} 66 defaults = {'date': None, 'rev': ['svnrev(2)'], 'user': None}
66 67
67 ui = CapturingUI() 68 ui = CapturingUI()
68 commands.log(ui, repo, template='{rev}:{svnrev} ', **defaults) 69 commands.log(ui, repo, template='{rev}:{svnrev} ', **defaults)
69 self.assertEqual(ui._output, '0:2 ') 70 self.assertEqual(ui._output, '0:2 ')
70 71
71 defaults = {'date': None, 'rev': ['fromsvn(1)'], 'user': None} 72 defaults = {'date': None, 'rev': ['fromsvn(1)'], 'user': None}
72 73
73 self.assertRaises(error.ParseError, 74 self.assertRaises(error.ParseError,
74 commands.log, self.ui(), repo, 75 commands.log, self.ui(), repo,
75 template='{rev}:{svnrev} ', **defaults) 76 template='{rev}:{svnrev} ', **defaults)
76 77
77 defaults = {'date': None, 'rev': ['svnrev(1, 2)'], 'user': None} 78 defaults = {'date': None, 'rev': ['svnrev(1, 2)'], 'user': None}
78 79
79 self.assertRaises(error.ParseError, 80 self.assertRaises(error.ParseError,
80 commands.log, self.ui(), repo, 81 commands.log, self.ui(), repo,
81 template='{rev}:{svnrev} ', **defaults) 82 template='{rev}:{svnrev} ', **defaults)
82 83
83 def suite(): 84 def suite():
84 all = [unittest.TestLoader().loadTestsFromTestCase(TestLogKeywords),] 85 all = [unittest.TestLoader().loadTestsFromTestCase(TestLogKeywords),]
85 return unittest.TestSuite(all) 86 return unittest.TestSuite(all)