annotate tests/test_push_dirs.py @ 725:c787147fa3b7

fix some style nits
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Wed, 06 Oct 2010 15:18:15 +0200
parents 04b3f476e2c3
children efb87d5bb311
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
83
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
1 import test_util
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
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: 323
diff changeset
3 import unittest
d2ef7220a079 tests: import test_util as the first module in all relevant tests
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 323
diff changeset
4
83
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
5 class TestPushDirectories(test_util.TestBase):
84
01e747937d35 test_util: add commitchanges() to TestBase
Patrick Mezard <pmezard@gmail.com>
parents: 83
diff changeset
6 def test_push_dirs(self):
700
04b3f476e2c3 test_push_dirs.py: activate tests that were previously overlooked
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
7 self._load_fixture_and_fetch('emptyrepo.svndump')
04b3f476e2c3 test_push_dirs.py: activate tests that were previously overlooked
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
8
83
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
9 changes = [
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
10 # Single file in single directory
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
11 ('d1/a', 'd1/a', 'a\n'),
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
12 # Two files in one directory
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
13 ('d2/a', 'd2/a', 'a\n'),
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
14 ('d2/b', 'd2/b', 'a\n'),
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
15 # Single file in empty directory hierarchy
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
16 ('d31/d32/d33/d34/a', 'd31/d32/d33/d34/a', 'a\n'),
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
17 ('d31/d32/a', 'd31/d32/a', 'a\n'),
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
18 ]
84
01e747937d35 test_util: add commitchanges() to TestBase
Patrick Mezard <pmezard@gmail.com>
parents: 83
diff changeset
19 self.commitchanges(changes)
83
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
20 self.pushrevisions()
268
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
21 self.assertEqual(self.svnls('trunk'),
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
22 ['d1', 'd1/a', 'd2', 'd2/a', 'd2/b', 'd31',
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
23 'd31/d32', 'd31/d32/a', 'd31/d32/d33',
83
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
24 'd31/d32/d33/d34', 'd31/d32/d33/d34/a'])
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
25
85
05a0c4f6060f push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents: 84
diff changeset
26 # Add one revision with changed files only, no directory addition
05a0c4f6060f push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents: 84
diff changeset
27 # or deletion.
05a0c4f6060f push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents: 84
diff changeset
28 changes = [
05a0c4f6060f push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents: 84
diff changeset
29 ('d1/a', 'd1/a', 'aa\n'),
05a0c4f6060f push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents: 84
diff changeset
30 ('d2/a', 'd2/a', 'aa\n'),
05a0c4f6060f push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents: 84
diff changeset
31 ]
05a0c4f6060f push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents: 84
diff changeset
32 self.commitchanges(changes)
05a0c4f6060f push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents: 84
diff changeset
33 self.pushrevisions()
05a0c4f6060f push_cmd: consider only dirs with added/removed files for addition or deletion
Patrick Mezard <pmezard@gmail.com>
parents: 84
diff changeset
34
83
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
35 changes = [
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
36 # Remove single file in single directory
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
37 ('d1/a', None, None),
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
38 # Remove one file out of two
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
39 ('d2/a', None, None),
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
40 # Removing this file should remove one empty parent dir too
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
41 ('d31/d32/d33/d34/a', None, None),
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
42 ]
84
01e747937d35 test_util: add commitchanges() to TestBase
Patrick Mezard <pmezard@gmail.com>
parents: 83
diff changeset
43 self.commitchanges(changes)
83
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
44 self.pushrevisions()
268
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
45 self.assertEqual(self.svnls('trunk'),
323
067914ecb4eb push: Fix a bug in deletion of an entire tree.
Augie Fackler <durin42@gmail.com>
parents: 268
diff changeset
46 ['d2', 'd2/b', 'd31', 'd31/d32', 'd31/d32/a', ])
83
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
47
268
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
48 def test_push_new_dir_project_root_not_repo_root(self):
700
04b3f476e2c3 test_push_dirs.py: activate tests that were previously overlooked
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
49 self._load_fixture_and_fetch('fetch_missing_files_subdir.svndump',
04b3f476e2c3 test_push_dirs.py: activate tests that were previously overlooked
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
50 subdir='foo')
268
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
51 changes = [('magic_new/a', 'magic_new/a', 'ohai', ),
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
52 ]
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
53 self.commitchanges(changes)
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
54 self.pushrevisions()
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
55 self.assertEqual(self.svnls('foo/trunk'), ['bar',
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
56 'bar/alpha',
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
57 'bar/beta',
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
58 'bar/delta',
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
59 'bar/gamma',
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
60 'foo',
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
61 'magic_new',
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
62 'magic_new/a'])
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
63
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
64 def test_push_new_file_existing_dir_root_not_repo_root(self):
700
04b3f476e2c3 test_push_dirs.py: activate tests that were previously overlooked
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
65 self._load_fixture_and_fetch('empty_dir_in_trunk_not_repo_root.svndump',
04b3f476e2c3 test_push_dirs.py: activate tests that were previously overlooked
Dan Villiom Podlaski Christiansen <danchr@gmail.com>
parents: 643
diff changeset
66 subdir='project')
268
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
67 changes = [('narf/a', 'narf/a', 'ohai', ),
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
68 ]
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
69 self.commitchanges(changes)
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
70 self.assertEqual(self.svnls('project/trunk'), ['a',
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
71 'narf',])
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
72 self.pushrevisions()
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
73 self.assertEqual(self.svnls('project/trunk'), ['a',
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
74 'narf',
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
75 'narf/a'])
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
76 changes = [('narf/a', None, None, ),
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
77 ]
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
78 self.commitchanges(changes)
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
79 self.pushrevisions()
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
80 self.assertEqual(self.svnls('project/trunk'), ['a' ,])
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
81
6ec5b5fc5b4d Added a test case for directory-add behavior when repo root is not project root.
Augie Fackler <durin42@gmail.com>
parents: 85
diff changeset
82
83
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
83 def suite():
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
84 all = [unittest.TestLoader().loadTestsFromTestCase(TestPushDirectories),
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
85 ]
6c9b7cf1c5aa push_cmd: delete empty svn directories, refactor directory creation
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
86 return unittest.TestSuite(all)