Mercurial > hgsubversion
annotate tests/test_diff.py @ 746:174f03c288d4
svnmeta: abort when no UUID given and none is stored on disk.
Previously, not passing a UUID when instantiating an SVNMeta instance
would cause it to succeed even if no UUID was previously known. First
when the UUID was actually read would an exception be raised.
This slight refactoring of _set_uuid() makes it so an exception is
raised immediately. While at it, the exception message is changed to
be slightly more accurate and helpful.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Thu, 11 Nov 2010 21:32:22 +0100 |
parents | 95abc4cfc78f |
children | e9af7eba88db |
rev | line source |
---|---|
643
d2ef7220a079
tests: import test_util as the first module in all relevant tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
347
diff
changeset
|
1 import test_util |
d2ef7220a079
tests: import test_util as the first module in all relevant tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
347
diff
changeset
|
2 |
153
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
3 import unittest |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
4 |
138
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
5 from mercurial import ui |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
6 |
337
46e69be8e2c8
Reorganize to have a more conventional module structure.
Augie Fackler <durin42@gmail.com>
parents:
331
diff
changeset
|
7 from hgsubversion import wrappers |
138
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
8 |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
9 expected_diff_output = '''Index: alpha |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
10 =================================================================== |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
11 --- alpha\t(revision 3) |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
12 +++ alpha\t(working copy) |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
13 @@ -1,1 +1,3 @@ |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
14 -file: alpha |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
15 +alpha |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
16 + |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
17 +added line |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
18 Index: foo |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
19 =================================================================== |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
20 new file mode 100644 |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
21 --- foo\t(revision 0) |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
22 +++ foo\t(working copy) |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
23 @@ -0,0 +1,1 @@ |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
24 +This is missing a newline. |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
25 \ No newline at end of file |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
26 ''' |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
27 |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
28 class DiffTests(test_util.TestBase): |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
29 def test_diff_output(self): |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
30 self._load_fixture_and_fetch('two_revs.svndump') |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
31 self.commitchanges([('foo', 'foo', 'This is missing a newline.'), |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
32 ('alpha', 'alpha', 'alpha\n\nadded line\n'), |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
33 ]) |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
34 u = ui.ui() |
331
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
257
diff
changeset
|
35 u.pushbuffer() |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
257
diff
changeset
|
36 wrappers.diff(lambda x,y,z: None, u, self.repo, svn=True) |
75f082b5897e
Switch to using url scheme wrappers instead of duplicating each command we wrap.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
257
diff
changeset
|
37 self.assertEqual(u.popbuffer(), expected_diff_output) |
153
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
38 |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
39 |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
40 def suite(): |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
41 all = [unittest.TestLoader().loadTestsFromTestCase(DiffTests), |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
42 ] |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
43 return unittest.TestSuite(all) |