Mercurial > hgsubversion
annotate tests/test_fetch_symlinks.py @ 1452:4217a050a088
tests: drop hard-coded list of tests
The list of out of date, missing 'test_helpers' and
'comprehensive/test_custom_layout'. Instead, use the discover
functionality introduced in Python 2.7, and available for Python 2.6
and earlier from the 'unittest2' backport.
Tested by invoking 'run.py' both with and without '-A' in Python 2.6 &
2.7, and ensuring that passing comprehensive tests as arguments
continues to work.
As a minor (but welcome) side-effect, this should restore the ability to
test hgsubversion under demandimport; previously, test_util was
imported before we enabled demandimport, so it didn't affect most of
Mercurial. Since unittest2 (and unittest) do define SkipTest, we can
remove the earlier import, restoring the likely originally intended
testing mode.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Sun, 12 Jun 2016 14:55:57 +0200 |
parents | 8b6fb32b001e |
children |
rev | line source |
---|---|
97
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
1 import test_util |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
2 |
643
d2ef7220a079
tests: import test_util as the first module in all relevant tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
145
diff
changeset
|
3 import unittest |
97
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
4 |
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
5 class TestFetchSymlinks(test_util.TestBase): |
1065
8b6fb32b001e
test_fetch_symlinks: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1044
diff
changeset
|
6 stupid_mode_tests = True |
8b6fb32b001e
test_fetch_symlinks: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1044
diff
changeset
|
7 |
8b6fb32b001e
test_fetch_symlinks: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1044
diff
changeset
|
8 def test_symlinks(self): |
8b6fb32b001e
test_fetch_symlinks: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1044
diff
changeset
|
9 repo = self._load_fixture_and_fetch('symlinks.svndump') |
741
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
10 # Check symlinks throughout history |
97
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
11 links = { |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
12 0: { |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
13 'linka': 'a', |
145
b37c401b7f92
hg_delta_editor: reset properties of deleted entries
Patrick Mezard <pmezard@gmail.com>
parents:
126
diff
changeset
|
14 'linka2': 'a', |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
15 'd/linka': 'a', |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
16 }, |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
17 1: { |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
18 'linkaa': 'a', |
145
b37c401b7f92
hg_delta_editor: reset properties of deleted entries
Patrick Mezard <pmezard@gmail.com>
parents:
126
diff
changeset
|
19 'linka2': 'a', |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
20 'd2/linka': 'a', |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
21 }, |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
22 2: { |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
23 'linkaa': 'b', |
145
b37c401b7f92
hg_delta_editor: reset properties of deleted entries
Patrick Mezard <pmezard@gmail.com>
parents:
126
diff
changeset
|
24 'linka2': 'a', |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
25 'd2/linka': 'b', |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
26 }, |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
27 3: { |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
28 }, |
741
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
29 4: { |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
30 'linka3': 'a', |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
31 }, |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
32 5: { |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
33 'linka3': 'a', |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
34 }, |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
35 6: { |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
36 'linka3': 'a', |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
37 'linka4': 'link to this', |
b3128fec5d54
editor: handle property changes to links.
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
643
diff
changeset
|
38 }, |
97
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
39 } |
832
e9af7eba88db
globally: clean up whitespace around operators and commas to conform with PEP8
Yonggang Luo <luoyonggang@gmail.com>
parents:
741
diff
changeset
|
40 |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
41 for rev in repo: |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
42 ctx = repo[rev] |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
43 for f in ctx.manifest(): |
859
1d07e86f5797
stupid: handle changes in svn 1.7 diff format
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
44 l = 'l' in ctx[f].flags() |
1d07e86f5797
stupid: handle changes in svn 1.7 diff format
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
45 lref = f in links[rev] |
1d07e86f5797
stupid: handle changes in svn 1.7 diff format
Patrick Mezard <patrick@mezard.eu>
parents:
833
diff
changeset
|
46 self.assertEqual(lref, l, '%r != %r for %s@%r' % (lref, l, f, rev)) |
126
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
47 if f in links[rev]: |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
48 self.assertEqual(links[rev][f], ctx[f].data()) |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
49 for f in links[rev]: |
24a64fb0e74b
run.py: register and develop test_fetch_symlinks
Patrick Mezard <pmezard@gmail.com>
parents:
101
diff
changeset
|
50 self.assertTrue(f in ctx) |
97
0d3a2a7cefa3
hg_delta_editor: fix symlink prefix confusion
Patrick Mezard <pmezard@gmail.com>
parents:
diff
changeset
|
51 |
901
bd12a4da0f35
replay: workaround svn not telling us about x/l flags (issue346)
Bryan O'Sullivan <bryano@fb.com>
parents:
865
diff
changeset
|
52 class TestMergeSpecial(test_util.TestBase): |
1065
8b6fb32b001e
test_fetch_symlinks: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1044
diff
changeset
|
53 stupid_mode_tests = True |
8b6fb32b001e
test_fetch_symlinks: use stupid mode metaclass
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents:
1044
diff
changeset
|
54 |
901
bd12a4da0f35
replay: workaround svn not telling us about x/l flags (issue346)
Bryan O'Sullivan <bryano@fb.com>
parents:
865
diff
changeset
|
55 def test_special(self): |
bd12a4da0f35
replay: workaround svn not telling us about x/l flags (issue346)
Bryan O'Sullivan <bryano@fb.com>
parents:
865
diff
changeset
|
56 repo = self._load_fixture_and_fetch('addspecial.svndump', |
bd12a4da0f35
replay: workaround svn not telling us about x/l flags (issue346)
Bryan O'Sullivan <bryano@fb.com>
parents:
865
diff
changeset
|
57 subdir='trunk') |
bd12a4da0f35
replay: workaround svn not telling us about x/l flags (issue346)
Bryan O'Sullivan <bryano@fb.com>
parents:
865
diff
changeset
|
58 ctx = repo['tip'] |
bd12a4da0f35
replay: workaround svn not telling us about x/l flags (issue346)
Bryan O'Sullivan <bryano@fb.com>
parents:
865
diff
changeset
|
59 self.assertEqual(ctx['fnord'].flags(), 'l') |
bd12a4da0f35
replay: workaround svn not telling us about x/l flags (issue346)
Bryan O'Sullivan <bryano@fb.com>
parents:
865
diff
changeset
|
60 self.assertEqual(ctx['exe'].flags(), 'x') |