Merge lp:~jml/launchpad/upcall-testcase into lp:launchpad
- upcall-testcase
- Merge into devel
Proposed by
Jonathan Lange
Status: | Merged |
---|---|
Approved by: | Michael Hudson-Doyle |
Approved revision: | not available |
Merged at revision: | not available |
Proposed branch: | lp:~jml/launchpad/upcall-testcase |
Merge into: | lp:launchpad |
Diff against target: |
828 lines (+88/-47) 28 files modified
lib/canonical/config/tests/test_config_lookup.py (+7/-7) lib/canonical/launchpad/scripts/tests/test_hwdb_submission_parser.py (+17/-12) lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py (+3/-0) lib/canonical/launchpad/scripts/tests/test_runlaunchpad.py (+2/-2) lib/canonical/launchpad/webapp/tests/__init__.py (+2/-1) lib/canonical/launchpad/webapp/tests/test_dbpolicy.py (+8/-5) lib/canonical/launchpad/webapp/tests/test_menu.py (+1/-0) lib/canonical/launchpad/webapp/tests/test_servers.py (+1/-2) lib/lp/archiveuploader/tests/test_buildduploads.py (+2/-2) lib/lp/archiveuploader/tests/test_ppauploadprocessor.py (+1/-1) lib/lp/archiveuploader/tests/test_securityuploads.py (+2/-2) lib/lp/archiveuploader/tests/test_uploadprocessor.py (+2/-1) lib/lp/code/browser/tests/test_branch.py (+4/-2) lib/lp/code/mail/tests/test_codehandler.py (+9/-3) lib/lp/code/model/tests/test_branch.py (+4/-1) lib/lp/code/model/tests/test_codereviewkarma.py (+2/-1) lib/lp/code/model/tests/test_revisionauthor.py (+3/-0) lib/lp/codehosting/puller/tests/test_worker.py (+1/-0) lib/lp/codehosting/tests/test_rewrite.py (+1/-1) lib/lp/registry/tests/test_distroseries.py (+1/-0) lib/lp/registry/tests/test_prf_walker.py (+3/-0) lib/lp/scripts/utilities/tests/test_sanitizedb.py (+1/-0) lib/lp/services/apachelogparser/tests/test_apachelogparser.py (+2/-0) lib/lp/services/database/tests/test_prejoin.py (+1/-0) lib/lp/services/mail/tests/test_mailbox.py (+2/-4) lib/lp/services/memcache/tests/test_memcache_client.py (+1/-0) lib/lp/soyuz/scripts/tests/test_copypackage.py (+1/-0) lib/lp/translations/scripts/tests/test_remove_translations.py (+4/-0) |
To merge this branch: | bzr merge lp:~jml/launchpad/upcall-testcase |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Hudson-Doyle | Approve | ||
Review via email: mp+17002@code.launchpad.net |
Commit message
Upcall setUp and tearDown everywhere, allowing use of testtools
Description of the change
To post a comment you must log in.
Revision history for this message
Jonathan Lange (jml) wrote : | # |
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote : | # |
It looks fine. I worry slightly about doing super(.
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'lib/canonical/config/tests/test_config_lookup.py' | |||
2 | --- lib/canonical/config/tests/test_config_lookup.py 2009-07-17 00:26:05 +0000 | |||
3 | +++ lib/canonical/config/tests/test_config_lookup.py 2010-01-08 04:12:19 +0000 | |||
4 | @@ -8,18 +8,17 @@ | |||
5 | 8 | 8 | ||
6 | 9 | import os | 9 | import os |
7 | 10 | import shutil | 10 | import shutil |
8 | 11 | from tempfile import mkdtemp, NamedTemporaryFile | ||
9 | 11 | import unittest | 12 | import unittest |
10 | 12 | 13 | ||
11 | 13 | from tempfile import mkdtemp, NamedTemporaryFile | ||
12 | 14 | from unittest import makeSuite, TestCase, TestSuite | ||
13 | 15 | |||
14 | 16 | import lp.testing | ||
15 | 17 | |||
16 | 18 | from canonical import config | 14 | from canonical import config |
17 | 15 | from lp.testing import TestCase | ||
18 | 16 | |||
19 | 19 | 17 | ||
20 | 20 | class TestConfigLookup(TestCase): | 18 | class TestConfigLookup(TestCase): |
21 | 21 | 19 | ||
22 | 22 | def setUp(self): | 20 | def setUp(self): |
23 | 21 | super(TestConfigLookup, self).setUp() | ||
24 | 23 | self.temp_lookup_file = None | 22 | self.temp_lookup_file = None |
25 | 24 | self.original_CONFIG_LOOKUP_FILES = config.CONFIG_LOOKUP_FILES | 23 | self.original_CONFIG_LOOKUP_FILES = config.CONFIG_LOOKUP_FILES |
26 | 25 | self.original_LPCONFIG = os.environ['LPCONFIG'] | 24 | self.original_LPCONFIG = os.environ['LPCONFIG'] |
27 | @@ -28,6 +27,7 @@ | |||
28 | 28 | del self.temp_lookup_file | 27 | del self.temp_lookup_file |
29 | 29 | config.CONFIG_LOOKUP_FILES = self.original_CONFIG_LOOKUP_FILES | 28 | config.CONFIG_LOOKUP_FILES = self.original_CONFIG_LOOKUP_FILES |
30 | 30 | os.environ['LPCONFIG'] = self.original_LPCONFIG | 29 | os.environ['LPCONFIG'] = self.original_LPCONFIG |
31 | 30 | super(TestConfigLookup, self).tearDown() | ||
32 | 31 | 31 | ||
33 | 32 | def makeLookupFile(self): | 32 | def makeLookupFile(self): |
34 | 33 | self.temp_lookup_file = NamedTemporaryFile() | 33 | self.temp_lookup_file = NamedTemporaryFile() |
35 | @@ -61,7 +61,7 @@ | |||
36 | 61 | config.find_instance_name(), config.DEFAULT_CONFIG) | 61 | config.find_instance_name(), config.DEFAULT_CONFIG) |
37 | 62 | 62 | ||
38 | 63 | 63 | ||
40 | 64 | class ConfigTestCase(lp.testing.TestCase): | 64 | class ConfigTestCase(TestCase): |
41 | 65 | """Base test case that provides fixtures for testing configuration. | 65 | """Base test case that provides fixtures for testing configuration. |
42 | 66 | """ | 66 | """ |
43 | 67 | 67 | ||
44 | @@ -79,7 +79,6 @@ | |||
45 | 79 | shutil.rmtree(self.temp_config_root_dir) | 79 | shutil.rmtree(self.temp_config_root_dir) |
46 | 80 | config.CONFIG_ROOT_DIRS = self.original_root_dirs | 80 | config.CONFIG_ROOT_DIRS = self.original_root_dirs |
47 | 81 | 81 | ||
48 | 82 | |||
49 | 83 | def setUpInstanceConfig(self, instance_name): | 82 | def setUpInstanceConfig(self, instance_name): |
50 | 84 | """Create an instance directory with empty config files. | 83 | """Create an instance directory with empty config files. |
51 | 85 | 84 | ||
52 | @@ -104,6 +103,7 @@ | |||
53 | 104 | """Test where instance config directories are looked up.""" | 103 | """Test where instance config directories are looked up.""" |
54 | 105 | 104 | ||
55 | 106 | def setUp(self): | 105 | def setUp(self): |
56 | 106 | super(TestInstanceConfigDirLookup, self).setUp() | ||
57 | 107 | self.setUpConfigRoots() | 107 | self.setUpConfigRoots() |
58 | 108 | 108 | ||
59 | 109 | def test_find_config_dir_raises_ValueError(self): | 109 | def test_find_config_dir_raises_ValueError(self): |
60 | 110 | 110 | ||
61 | === modified file 'lib/canonical/launchpad/scripts/tests/test_hwdb_submission_parser.py' | |||
62 | --- lib/canonical/launchpad/scripts/tests/test_hwdb_submission_parser.py 2009-10-27 14:36:03 +0000 | |||
63 | +++ lib/canonical/launchpad/scripts/tests/test_hwdb_submission_parser.py 2010-01-08 04:12:19 +0000 | |||
64 | @@ -25,12 +25,14 @@ | |||
65 | 25 | 25 | ||
66 | 26 | from lp.testing import TestCase, validate_mock_class | 26 | from lp.testing import TestCase, validate_mock_class |
67 | 27 | 27 | ||
68 | 28 | |||
69 | 28 | class SubmissionParserTestParseSoftware(SubmissionParser): | 29 | class SubmissionParserTestParseSoftware(SubmissionParser): |
70 | 29 | """A Variant used to test SubmissionParser._parseSoftware. | 30 | """A Variant used to test SubmissionParser._parseSoftware. |
71 | 30 | 31 | ||
72 | 31 | This class can be used to test the regular case of | 32 | This class can be used to test the regular case of |
73 | 32 | submission data. | 33 | submission data. |
74 | 33 | """ | 34 | """ |
75 | 35 | |||
76 | 34 | def __init__(self, test, logger=None): | 36 | def __init__(self, test, logger=None): |
77 | 35 | super(SubmissionParserTestParseSoftware, self).__init__(logger) | 37 | super(SubmissionParserTestParseSoftware, self).__init__(logger) |
78 | 36 | self.test = test | 38 | self.test = test |
79 | @@ -54,6 +56,7 @@ | |||
80 | 54 | This class is intended to test submission data that does not contain | 56 | This class is intended to test submission data that does not contain |
81 | 55 | a <xorg> node. | 57 | a <xorg> node. |
82 | 56 | """ | 58 | """ |
83 | 59 | |||
84 | 57 | def __init__(self, test, logger=None): | 60 | def __init__(self, test, logger=None): |
85 | 58 | super(SubmissionParserTestParseSoftwareNoXorgNode, self).__init__( | 61 | super(SubmissionParserTestParseSoftwareNoXorgNode, self).__init__( |
86 | 59 | logger) | 62 | logger) |
87 | @@ -74,6 +77,7 @@ | |||
88 | 74 | This class is intended to test submission data that does not contain | 77 | This class is intended to test submission data that does not contain |
89 | 75 | a <packages> node. | 78 | a <packages> node. |
90 | 76 | """ | 79 | """ |
91 | 80 | |||
92 | 77 | def __init__(self, test, logger=None): | 81 | def __init__(self, test, logger=None): |
93 | 78 | super(SubmissionParserTestParseSoftwareNoPackagesNode, self).__init__( | 82 | super(SubmissionParserTestParseSoftwareNoPackagesNode, self).__init__( |
94 | 79 | logger) | 83 | logger) |
95 | @@ -95,6 +99,7 @@ | |||
96 | 95 | 99 | ||
97 | 96 | def setUp(self): | 100 | def setUp(self): |
98 | 97 | """Setup the test environment.""" | 101 | """Setup the test environment.""" |
99 | 102 | super(TestHWDBSubmissionParser, self).setUp() | ||
100 | 98 | self.log = logging.getLogger('test_hwdb_submission_parser') | 103 | self.log = logging.getLogger('test_hwdb_submission_parser') |
101 | 99 | self.log.setLevel(logging.INFO) | 104 | self.log.setLevel(logging.INFO) |
102 | 100 | self.handler = Handler(self) | 105 | self.handler = Handler(self) |
103 | @@ -250,7 +255,7 @@ | |||
104 | 250 | {'name': 'architecture_info', | 255 | {'name': 'architecture_info', |
105 | 251 | 'version': '1.1'}, | 256 | 'version': '1.1'}, |
106 | 252 | {'name': 'find_network_controllers', | 257 | {'name': 'find_network_controllers', |
108 | 253 | 'version': '2.34'}]} | 258 | 'version': '2.34'}]}, |
109 | 254 | } | 259 | } |
110 | 255 | self.assertEqual( | 260 | self.assertEqual( |
111 | 256 | summary, expected_data, | 261 | summary, expected_data, |
112 | @@ -293,7 +298,7 @@ | |||
113 | 293 | 'plugins': [ | 298 | 'plugins': [ |
114 | 294 | { | 299 | { |
115 | 295 | 'name': 'architecture_info', | 300 | 'name': 'architecture_info', |
117 | 296 | 'version': '1.1' | 301 | 'version': '1.1', |
118 | 297 | }, | 302 | }, |
119 | 298 | { | 303 | { |
120 | 299 | 'name': 'find_network_controllers', | 304 | 'name': 'find_network_controllers', |
121 | @@ -484,7 +489,6 @@ | |||
122 | 484 | """) | 489 | """) |
123 | 485 | self.assertRaises(ValueError, parser._parseProperties, node) | 490 | self.assertRaises(ValueError, parser._parseProperties, node) |
124 | 486 | 491 | ||
125 | 487 | |||
126 | 488 | def testDevice(self): | 492 | def testDevice(self): |
127 | 489 | """A device node is converted into a dictionary.""" | 493 | """A device node is converted into a dictionary.""" |
128 | 490 | test = self | 494 | test = self |
129 | @@ -919,6 +923,7 @@ | |||
130 | 919 | 923 | ||
131 | 920 | All "method substitutes" return a valid result. | 924 | All "method substitutes" return a valid result. |
132 | 921 | """ | 925 | """ |
133 | 926 | |||
134 | 922 | def __init__(self, logger=None): | 927 | def __init__(self, logger=None): |
135 | 923 | super(self.__class__, self).__init__(logger) | 928 | super(self.__class__, self).__init__(logger) |
136 | 924 | self.hal_result = 'parsed HAL data' | 929 | self.hal_result = 'parsed HAL data' |
137 | @@ -1312,6 +1317,7 @@ | |||
138 | 1312 | 1317 | ||
139 | 1313 | All "method substitutes" return a valid result. | 1318 | All "method substitutes" return a valid result. |
140 | 1314 | """ | 1319 | """ |
141 | 1320 | |||
142 | 1315 | def __init__(self, logger=None): | 1321 | def __init__(self, logger=None): |
143 | 1316 | SubmissionParser.__init__(self, logger) | 1322 | SubmissionParser.__init__(self, logger) |
144 | 1317 | self.summary_result = 'parsed summary' | 1323 | self.summary_result = 'parsed summary' |
145 | @@ -1363,8 +1369,8 @@ | |||
146 | 1363 | 'summary': 'parsed summary', | 1369 | 'summary': 'parsed summary', |
147 | 1364 | 'hardware': 'parsed hardware', | 1370 | 'hardware': 'parsed hardware', |
148 | 1365 | 'software': 'parsed software', | 1371 | 'software': 'parsed software', |
151 | 1366 | 'questions': 'parsed questions', | 1372 | 'questions': 'parsed questions', |
152 | 1367 | 'context': 'parsed context', | 1373 | 'context': 'parsed context', |
153 | 1368 | } | 1374 | } |
154 | 1369 | 1375 | ||
155 | 1370 | result = parser.parseMainSections(node) | 1376 | result = parser.parseMainSections(node) |
156 | @@ -1550,7 +1556,7 @@ | |||
157 | 1550 | 'hardware': { | 1556 | 'hardware': { |
158 | 1551 | 'udev': udev, | 1557 | 'udev': udev, |
159 | 1552 | 'sysfs-attributes': sysfs_attributes, | 1558 | 'sysfs-attributes': sysfs_attributes, |
161 | 1553 | 'processors': processors | 1559 | 'processors': processors, |
162 | 1554 | }, | 1560 | }, |
163 | 1555 | 'software': { | 1561 | 'software': { |
164 | 1556 | 'packages': packages | 1562 | 'packages': packages |
165 | @@ -1579,7 +1585,7 @@ | |||
166 | 1579 | ] | 1585 | ] |
167 | 1580 | processors = [ | 1586 | processors = [ |
168 | 1581 | {'id': 1}, | 1587 | {'id': 1}, |
170 | 1582 | {'id': 2} | 1588 | {'id': 2}, |
171 | 1583 | ] | 1589 | ] |
172 | 1584 | packages = { | 1590 | packages = { |
173 | 1585 | 'bzr': {'id': 4}, | 1591 | 'bzr': {'id': 4}, |
174 | @@ -1589,7 +1595,7 @@ | |||
175 | 1589 | 'hardware': { | 1595 | 'hardware': { |
176 | 1590 | 'udev': udev, | 1596 | 'udev': udev, |
177 | 1591 | 'sysfs-attributes': sysfs_attributes, | 1597 | 'sysfs-attributes': sysfs_attributes, |
179 | 1592 | 'processors': processors | 1598 | 'processors': processors, |
180 | 1593 | }, | 1599 | }, |
181 | 1594 | 'software': { | 1600 | 'software': { |
182 | 1595 | 'packages': packages | 1601 | 'packages': packages |
183 | @@ -1646,7 +1652,7 @@ | |||
184 | 1646 | submission = { | 1652 | submission = { |
185 | 1647 | 'hardware': { | 1653 | 'hardware': { |
186 | 1648 | 'udev': devices, | 1654 | 'udev': devices, |
188 | 1649 | 'processors': processors | 1655 | 'processors': processors, |
189 | 1650 | }, | 1656 | }, |
190 | 1651 | 'software': { | 1657 | 'software': { |
191 | 1652 | 'packages': packages | 1658 | 'packages': packages |
192 | @@ -1707,8 +1713,7 @@ | |||
193 | 1707 | {'udi': DEVICE_2_UDI, | 1713 | {'udi': DEVICE_2_UDI, |
194 | 1708 | 'properties': { | 1714 | 'properties': { |
195 | 1709 | 'info.parent': (ROOT_UDI, | 1715 | 'info.parent': (ROOT_UDI, |
198 | 1710 | 'dbus.String')} | 1716 | 'dbus.String')}}] |
197 | 1711 | }] | ||
199 | 1712 | 1717 | ||
200 | 1713 | def testUDIDeviceMap(self): | 1718 | def testUDIDeviceMap(self): |
201 | 1714 | """Test the creation of the mapping UDI -> device.""" | 1719 | """Test the creation of the mapping UDI -> device.""" |
202 | @@ -1893,7 +1898,7 @@ | |||
203 | 1893 | 'properties': | 1898 | 'properties': |
204 | 1894 | {'info.parent': | 1899 | {'info.parent': |
205 | 1895 | (self.CIRCULAR_UDI_1, 'str')}} | 1900 | (self.CIRCULAR_UDI_1, 'str')}} |
207 | 1896 | devices = [device1, device2, circular_device1, circular_device2] | 1901 | devices = [device1, device2, circular_device1, circular_device2] |
208 | 1897 | parser = SubmissionParser() | 1902 | parser = SubmissionParser() |
209 | 1898 | udi_device_map = parser.getUDIDeviceMap(devices) | 1903 | udi_device_map = parser.getUDIDeviceMap(devices) |
210 | 1899 | udi_children = parser.getUDIChildren(udi_device_map) | 1904 | udi_children = parser.getUDIChildren(udi_device_map) |
211 | 1900 | 1905 | ||
212 | === modified file 'lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py' | |||
213 | --- lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py 2009-11-05 15:12:46 +0000 | |||
214 | +++ lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py 2010-01-08 04:12:19 +0000 | |||
215 | @@ -34,6 +34,7 @@ | |||
216 | 34 | 34 | ||
217 | 35 | from lp.testing import TestCase, validate_mock_class | 35 | from lp.testing import TestCase, validate_mock_class |
218 | 36 | 36 | ||
219 | 37 | |||
220 | 37 | class TestCaseHWDB(TestCase): | 38 | class TestCaseHWDB(TestCase): |
221 | 38 | """Common base class for HWDB processing tests.""" | 39 | """Common base class for HWDB processing tests.""" |
222 | 39 | 40 | ||
223 | @@ -91,6 +92,7 @@ | |||
224 | 91 | 92 | ||
225 | 92 | def setUp(self): | 93 | def setUp(self): |
226 | 93 | """Setup the test environment.""" | 94 | """Setup the test environment.""" |
227 | 95 | super(TestCaseHWDB, self).setUp() | ||
228 | 94 | self.log = logging.getLogger('test_hwdb_submission_parser') | 96 | self.log = logging.getLogger('test_hwdb_submission_parser') |
229 | 95 | self.log.setLevel(logging.INFO) | 97 | self.log.setLevel(logging.INFO) |
230 | 96 | self.handler = Handler(self) | 98 | self.handler = Handler(self) |
231 | @@ -4534,6 +4536,7 @@ | |||
232 | 4534 | 4536 | ||
233 | 4535 | def setUp(self): | 4537 | def setUp(self): |
234 | 4536 | """Setup the test environment.""" | 4538 | """Setup the test environment.""" |
235 | 4539 | super(TestHWDBSubmissionTablePopulation, self).setUp() | ||
236 | 4537 | self.log = logging.getLogger('test_hwdb_submission_parser') | 4540 | self.log = logging.getLogger('test_hwdb_submission_parser') |
237 | 4538 | self.log.setLevel(logging.INFO) | 4541 | self.log.setLevel(logging.INFO) |
238 | 4539 | self.handler = Handler(self) | 4542 | self.handler = Handler(self) |
239 | 4540 | 4543 | ||
240 | === modified file 'lib/canonical/launchpad/scripts/tests/test_runlaunchpad.py' | |||
241 | --- lib/canonical/launchpad/scripts/tests/test_runlaunchpad.py 2009-08-12 19:07:45 +0000 | |||
242 | +++ lib/canonical/launchpad/scripts/tests/test_runlaunchpad.py 2010-01-08 04:12:19 +0000 | |||
243 | @@ -6,7 +6,7 @@ | |||
244 | 6 | __metaclass__ = type | 6 | __metaclass__ = type |
245 | 7 | __all__ = [ | 7 | __all__ = [ |
246 | 8 | 'CommandLineArgumentProcessing', | 8 | 'CommandLineArgumentProcessing', |
248 | 9 | 'ServersToStart' | 9 | 'ServersToStart', |
249 | 10 | ] | 10 | ] |
250 | 11 | 11 | ||
251 | 12 | 12 | ||
252 | @@ -68,11 +68,11 @@ | |||
253 | 68 | split_out_runlaunchpad_arguments(['-o', 'foo', '--bar=baz'])) | 68 | split_out_runlaunchpad_arguments(['-o', 'foo', '--bar=baz'])) |
254 | 69 | 69 | ||
255 | 70 | 70 | ||
256 | 71 | |||
257 | 72 | class TestDefaultConfigArgument(lp.testing.TestCase): | 71 | class TestDefaultConfigArgument(lp.testing.TestCase): |
258 | 73 | """Tests for the processing of the -C argument.""" | 72 | """Tests for the processing of the -C argument.""" |
259 | 74 | 73 | ||
260 | 75 | def setUp(self): | 74 | def setUp(self): |
261 | 75 | super(TestDefaultConfigArgument, self).setUp() | ||
262 | 76 | self.config_root = tempfile.mkdtemp('configs') | 76 | self.config_root = tempfile.mkdtemp('configs') |
263 | 77 | self.saved_instance = config.instance_name | 77 | self.saved_instance = config.instance_name |
264 | 78 | self.saved_config_roots = canonical.config.CONFIG_ROOT_DIRS | 78 | self.saved_config_roots = canonical.config.CONFIG_ROOT_DIRS |
265 | 79 | 79 | ||
266 | === modified file 'lib/canonical/launchpad/webapp/tests/__init__.py' | |||
267 | --- lib/canonical/launchpad/webapp/tests/__init__.py 2009-08-20 13:32:32 +0000 | |||
268 | +++ lib/canonical/launchpad/webapp/tests/__init__.py 2010-01-08 04:12:19 +0000 | |||
269 | @@ -21,10 +21,11 @@ | |||
270 | 21 | """A test case that installs a DummyWebServiceConfiguration.""" | 21 | """A test case that installs a DummyWebServiceConfiguration.""" |
271 | 22 | 22 | ||
272 | 23 | def setUp(self): | 23 | def setUp(self): |
273 | 24 | super(DummyConfigurationTestCase, self).setUp() | ||
274 | 24 | self.config = DummyWebServiceConfiguration() | 25 | self.config = DummyWebServiceConfiguration() |
275 | 25 | provideUtility(self.config, IWebServiceConfiguration) | 26 | provideUtility(self.config, IWebServiceConfiguration) |
276 | 26 | 27 | ||
277 | 27 | def tearDown(self): | 28 | def tearDown(self): |
278 | 28 | getGlobalSiteManager().unregisterUtility( | 29 | getGlobalSiteManager().unregisterUtility( |
279 | 29 | self.config, IWebServiceConfiguration) | 30 | self.config, IWebServiceConfiguration) |
281 | 30 | 31 | super(DummyConfigurationTestCase, self).tearDown() | |
282 | 31 | 32 | ||
283 | === modified file 'lib/canonical/launchpad/webapp/tests/test_dbpolicy.py' | |||
284 | --- lib/canonical/launchpad/webapp/tests/test_dbpolicy.py 2009-10-13 05:48:15 +0000 | |||
285 | +++ lib/canonical/launchpad/webapp/tests/test_dbpolicy.py 2010-01-08 04:12:19 +0000 | |||
286 | @@ -60,12 +60,14 @@ | |||
287 | 60 | policy = None | 60 | policy = None |
288 | 61 | 61 | ||
289 | 62 | def setUp(self): | 62 | def setUp(self): |
290 | 63 | super(BaseDatabasePolicyTestCase, self).setUp() | ||
291 | 63 | if self.policy is None: | 64 | if self.policy is None: |
292 | 64 | self.policy = BaseDatabasePolicy() | 65 | self.policy = BaseDatabasePolicy() |
293 | 65 | getUtility(IStoreSelector).push(self.policy) | 66 | getUtility(IStoreSelector).push(self.policy) |
294 | 66 | 67 | ||
295 | 67 | def tearDown(self): | 68 | def tearDown(self): |
296 | 68 | getUtility(IStoreSelector).pop() | 69 | getUtility(IStoreSelector).pop() |
297 | 70 | super(BaseDatabasePolicyTestCase, self).tearDown() | ||
298 | 69 | 71 | ||
299 | 70 | def test_correctly_implements_IDatabasePolicy(self): | 72 | def test_correctly_implements_IDatabasePolicy(self): |
300 | 71 | self.assertProvides(self.policy, IDatabasePolicy) | 73 | self.assertProvides(self.policy, IDatabasePolicy) |
301 | @@ -77,7 +79,7 @@ | |||
302 | 77 | def setUp(self): | 79 | def setUp(self): |
303 | 78 | if self.policy is None: | 80 | if self.policy is None: |
304 | 79 | self.policy = SlaveDatabasePolicy() | 81 | self.policy = SlaveDatabasePolicy() |
306 | 80 | BaseDatabasePolicyTestCase.setUp(self) | 82 | super(SlaveDatabasePolicyTestCase, self).setUp() |
307 | 81 | 83 | ||
308 | 82 | def test_defaults(self): | 84 | def test_defaults(self): |
309 | 83 | for store in ALL_STORES: | 85 | for store in ALL_STORES: |
310 | @@ -97,7 +99,7 @@ | |||
311 | 97 | 99 | ||
312 | 98 | def setUp(self): | 100 | def setUp(self): |
313 | 99 | self.policy = SlaveOnlyDatabasePolicy() | 101 | self.policy = SlaveOnlyDatabasePolicy() |
315 | 100 | BaseDatabasePolicyTestCase.setUp(self) | 102 | super(SlaveOnlyDatabasePolicyTestCase, self).setUp() |
316 | 101 | 103 | ||
317 | 102 | def test_master_allowed(self): | 104 | def test_master_allowed(self): |
318 | 103 | for store in ALL_STORES: | 105 | for store in ALL_STORES: |
319 | @@ -111,7 +113,7 @@ | |||
320 | 111 | 113 | ||
321 | 112 | def setUp(self): | 114 | def setUp(self): |
322 | 113 | self.policy = MasterDatabasePolicy() | 115 | self.policy = MasterDatabasePolicy() |
324 | 114 | BaseDatabasePolicyTestCase.setUp(self) | 116 | super(MasterDatabasePolicyTestCase, self).setUp() |
325 | 115 | 117 | ||
326 | 116 | def test_XMLRPCRequest_uses_MasterPolicy(self): | 118 | def test_XMLRPCRequest_uses_MasterPolicy(self): |
327 | 117 | """XMLRPC should always use the master flavor, since they always | 119 | """XMLRPC should always use the master flavor, since they always |
328 | @@ -139,10 +141,11 @@ | |||
329 | 139 | This test just checks the defaults, which is the same as the | 141 | This test just checks the defaults, which is the same as the |
330 | 140 | slave policy for unauthenticated requests. | 142 | slave policy for unauthenticated requests. |
331 | 141 | """ | 143 | """ |
332 | 144 | |||
333 | 142 | def setUp(self): | 145 | def setUp(self): |
334 | 143 | request = LaunchpadTestRequest(SERVER_URL='http://launchpad.dev') | 146 | request = LaunchpadTestRequest(SERVER_URL='http://launchpad.dev') |
335 | 144 | self.policy = LaunchpadDatabasePolicy(request) | 147 | self.policy = LaunchpadDatabasePolicy(request) |
337 | 145 | SlaveDatabasePolicyTestCase.setUp(self) | 148 | super(LaunchpadDatabasePolicyTestCase, self).setUp() |
338 | 146 | 149 | ||
339 | 147 | 150 | ||
340 | 148 | class LayerDatabasePolicyTestCase(TestCase): | 151 | class LayerDatabasePolicyTestCase(TestCase): |
341 | @@ -243,7 +246,7 @@ | |||
342 | 243 | 246 | ||
343 | 244 | def setUp(self): | 247 | def setUp(self): |
344 | 245 | self.policy = ReadOnlyLaunchpadDatabasePolicy() | 248 | self.policy = ReadOnlyLaunchpadDatabasePolicy() |
346 | 246 | BaseDatabasePolicyTestCase.setUp(self) | 249 | super(ReadOnlyLaunchpadDatabasePolicyTestCase, self).setUp() |
347 | 247 | 250 | ||
348 | 248 | def test_defaults(self): | 251 | def test_defaults(self): |
349 | 249 | # default Store is the slave. | 252 | # default Store is the slave. |
350 | 250 | 253 | ||
351 | === modified file 'lib/canonical/launchpad/webapp/tests/test_menu.py' | |||
352 | --- lib/canonical/launchpad/webapp/tests/test_menu.py 2009-08-05 17:19:14 +0000 | |||
353 | +++ lib/canonical/launchpad/webapp/tests/test_menu.py 2010-01-08 04:12:19 +0000 | |||
354 | @@ -36,6 +36,7 @@ | |||
355 | 36 | 36 | ||
356 | 37 | def tearDown(self): | 37 | def tearDown(self): |
357 | 38 | logout() | 38 | logout() |
358 | 39 | super(TestMenuBaseLinkCaching, self).tearDown() | ||
359 | 39 | 40 | ||
360 | 40 | def test_no_cache_when_there_is_no_request(self): | 41 | def test_no_cache_when_there_is_no_request(self): |
361 | 41 | # Calling login() would cause a new interaction to be setup with a | 42 | # Calling login() would cause a new interaction to be setup with a |
362 | 42 | 43 | ||
363 | === modified file 'lib/canonical/launchpad/webapp/tests/test_servers.py' | |||
364 | --- lib/canonical/launchpad/webapp/tests/test_servers.py 2009-09-17 14:23:16 +0000 | |||
365 | +++ lib/canonical/launchpad/webapp/tests/test_servers.py 2010-01-08 04:12:19 +0000 | |||
366 | @@ -418,7 +418,7 @@ | |||
367 | 418 | {'QUERY_STRING': "a=1&b=2&c=3", 'REQUEST_METHOD': 'POST'}) | 418 | {'QUERY_STRING': "a=1&b=2&c=3", 'REQUEST_METHOD': 'POST'}) |
368 | 419 | self.assertEqual(request.method, 'POST') | 419 | self.assertEqual(request.method, 'POST') |
369 | 420 | self.assertEqual( | 420 | self.assertEqual( |
371 | 421 | {'a':['1'], 'b': ['2'], 'c': ['3']}, | 421 | {'a': ['1'], 'b': ['2'], 'c': ['3']}, |
372 | 422 | request.query_string_params, | 422 | request.query_string_params, |
373 | 423 | "The query_string_params dict is populated from the " | 423 | "The query_string_params dict is populated from the " |
374 | 424 | "QUERY_STRING during POST requests.") | 424 | "QUERY_STRING during POST requests.") |
375 | @@ -461,4 +461,3 @@ | |||
376 | 461 | optionflags=NORMALIZE_WHITESPACE | ELLIPSIS)) | 461 | optionflags=NORMALIZE_WHITESPACE | ELLIPSIS)) |
377 | 462 | suite.addTest(unittest.TestLoader().loadTestsFromName(__name__)) | 462 | suite.addTest(unittest.TestLoader().loadTestsFromName(__name__)) |
378 | 463 | return suite | 463 | return suite |
379 | 464 | |||
380 | 465 | 464 | ||
381 | === modified file 'lib/lp/archiveuploader/tests/test_buildduploads.py' | |||
382 | --- lib/lp/archiveuploader/tests/test_buildduploads.py 2009-08-28 07:34:44 +0000 | |||
383 | +++ lib/lp/archiveuploader/tests/test_buildduploads.py 2010-01-08 04:12:19 +0000 | |||
384 | @@ -70,7 +70,7 @@ | |||
385 | 70 | 70 | ||
386 | 71 | real_policy = self.policy | 71 | real_policy = self.policy |
387 | 72 | self.policy = 'insecure' | 72 | self.policy = 'insecure' |
389 | 73 | TestStagedBinaryUploadBase.setUp(self) | 73 | super(TestBuilddUploads, self).setUp() |
390 | 74 | self.policy = real_policy | 74 | self.policy = real_policy |
391 | 75 | 75 | ||
392 | 76 | def _publishBuildQueueItem(self, queue_item): | 76 | def _publishBuildQueueItem(self, queue_item): |
393 | @@ -125,6 +125,6 @@ | |||
394 | 125 | build_used.title) | 125 | build_used.title) |
395 | 126 | self.assertEqual('FULLYBUILT', build_used.buildstate.name) | 126 | self.assertEqual('FULLYBUILT', build_used.buildstate.name) |
396 | 127 | 127 | ||
397 | 128 | |||
398 | 128 | def test_suite(): | 129 | def test_suite(): |
399 | 129 | return unittest.TestLoader().loadTestsFromName(__name__) | 130 | return unittest.TestLoader().loadTestsFromName(__name__) |
400 | 130 | |||
401 | 131 | 131 | ||
402 | === modified file 'lib/lp/archiveuploader/tests/test_ppauploadprocessor.py' | |||
403 | --- lib/lp/archiveuploader/tests/test_ppauploadprocessor.py 2009-11-18 02:58:23 +0000 | |||
404 | +++ lib/lp/archiveuploader/tests/test_ppauploadprocessor.py 2010-01-08 04:12:19 +0000 | |||
405 | @@ -50,7 +50,7 @@ | |||
406 | 50 | Additionally to the TestUploadProcessorBase.setUp, set 'breezy' | 50 | Additionally to the TestUploadProcessorBase.setUp, set 'breezy' |
407 | 51 | distroseries and an new uploadprocessor instance. | 51 | distroseries and an new uploadprocessor instance. |
408 | 52 | """ | 52 | """ |
410 | 53 | TestUploadProcessorBase.setUp(self) | 53 | super(TestPPAUploadProcessorBase, self).setUp() |
411 | 54 | self.ubuntu = getUtility(IDistributionSet).getByName('ubuntu') | 54 | self.ubuntu = getUtility(IDistributionSet).getByName('ubuntu') |
412 | 55 | # Let's make 'name16' person member of 'launchpad-beta-tester' | 55 | # Let's make 'name16' person member of 'launchpad-beta-tester' |
413 | 56 | # team only in the context of this test. | 56 | # team only in the context of this test. |
414 | 57 | 57 | ||
415 | === modified file 'lib/lp/archiveuploader/tests/test_securityuploads.py' | |||
416 | --- lib/lp/archiveuploader/tests/test_securityuploads.py 2009-08-28 07:34:44 +0000 | |||
417 | +++ lib/lp/archiveuploader/tests/test_securityuploads.py 2010-01-08 04:12:19 +0000 | |||
418 | @@ -67,7 +67,7 @@ | |||
419 | 67 | 6. Clean log messages. | 67 | 6. Clean log messages. |
420 | 68 | 7. Commit transaction, so the upload source can be seen. | 68 | 7. Commit transaction, so the upload source can be seen. |
421 | 69 | """ | 69 | """ |
423 | 70 | TestUploadProcessorBase.setUp(self) | 70 | super(TestStagedBinaryUploadBase, self).setUp() |
424 | 71 | self.options.context = self.policy | 71 | self.options.context = self.policy |
425 | 72 | self.options.nomails = self.no_mails | 72 | self.options.nomails = self.no_mails |
426 | 73 | # Set up the uploadprocessor with appropriate options and logger | 73 | # Set up the uploadprocessor with appropriate options and logger |
427 | @@ -164,7 +164,7 @@ | |||
428 | 164 | 164 | ||
429 | 165 | def setUp(self): | 165 | def setUp(self): |
430 | 166 | """Setup base class and create the required new distroarchseries.""" | 166 | """Setup base class and create the required new distroarchseries.""" |
432 | 167 | TestStagedBinaryUploadBase.setUp(self) | 167 | super(TestStagedSecurityUploads, self).setUp() |
433 | 168 | distribution = getUtility(IDistributionSet).getByName( | 168 | distribution = getUtility(IDistributionSet).getByName( |
434 | 169 | self.distribution_name) | 169 | self.distribution_name) |
435 | 170 | distroseries = distribution[self.distroseries.name] | 170 | distroseries = distribution[self.distroseries.name] |
436 | 171 | 171 | ||
437 | === modified file 'lib/lp/archiveuploader/tests/test_uploadprocessor.py' | |||
438 | --- lib/lp/archiveuploader/tests/test_uploadprocessor.py 2009-11-18 02:58:23 +0000 | |||
439 | +++ lib/lp/archiveuploader/tests/test_uploadprocessor.py 2010-01-08 04:12:19 +0000 | |||
440 | @@ -107,7 +107,7 @@ | |||
441 | 107 | layer = LaunchpadZopelessLayer | 107 | layer = LaunchpadZopelessLayer |
442 | 108 | 108 | ||
443 | 109 | def setUp(self): | 109 | def setUp(self): |
445 | 110 | TestCaseWithFactory.setUp(self) | 110 | super(TestUploadProcessorBase, self).setUp() |
446 | 111 | 111 | ||
447 | 112 | self.queue_folder = tempfile.mkdtemp() | 112 | self.queue_folder = tempfile.mkdtemp() |
448 | 113 | os.makedirs(os.path.join(self.queue_folder, "incoming")) | 113 | os.makedirs(os.path.join(self.queue_folder, "incoming")) |
449 | @@ -134,6 +134,7 @@ | |||
450 | 134 | 134 | ||
451 | 135 | def tearDown(self): | 135 | def tearDown(self): |
452 | 136 | shutil.rmtree(self.queue_folder) | 136 | shutil.rmtree(self.queue_folder) |
453 | 137 | super(TestUploadProcessorBase, self).tearDown() | ||
454 | 137 | 138 | ||
455 | 138 | def assertLogContains(self, line): | 139 | def assertLogContains(self, line): |
456 | 139 | """Assert if a given line is present in the log messages.""" | 140 | """Assert if a given line is present in the log messages.""" |
457 | 140 | 141 | ||
458 | === modified file 'lib/lp/code/browser/tests/test_branch.py' | |||
459 | --- lib/lp/code/browser/tests/test_branch.py 2009-11-13 21:16:15 +0000 | |||
460 | +++ lib/lp/code/browser/tests/test_branch.py 2010-01-08 04:12:19 +0000 | |||
461 | @@ -119,12 +119,13 @@ | |||
462 | 119 | layer = LaunchpadFunctionalLayer | 119 | layer = LaunchpadFunctionalLayer |
463 | 120 | 120 | ||
464 | 121 | def setUp(self): | 121 | def setUp(self): |
466 | 122 | TestCaseWithFactory.setUp(self) | 122 | super(TestBranchView, self).setUp() |
467 | 123 | login(ANONYMOUS) | 123 | login(ANONYMOUS) |
468 | 124 | self.request = LaunchpadTestRequest() | 124 | self.request = LaunchpadTestRequest() |
469 | 125 | 125 | ||
470 | 126 | def tearDown(self): | 126 | def tearDown(self): |
471 | 127 | logout() | 127 | logout() |
472 | 128 | super(TestBranchView, self).tearDown() | ||
473 | 128 | 129 | ||
474 | 129 | def testMirrorStatusMessageIsTruncated(self): | 130 | def testMirrorStatusMessageIsTruncated(self): |
475 | 130 | """mirror_status_message is truncated if the text is overly long.""" | 131 | """mirror_status_message is truncated if the text is overly long.""" |
476 | @@ -238,13 +239,14 @@ | |||
477 | 238 | layer = DatabaseFunctionalLayer | 239 | layer = DatabaseFunctionalLayer |
478 | 239 | 240 | ||
479 | 240 | def setUp(self): | 241 | def setUp(self): |
481 | 241 | TestCaseWithFactory.setUp(self) | 242 | super(TestBranchAddView, self).setUp() |
482 | 242 | self.person = self.factory.makePerson() | 243 | self.person = self.factory.makePerson() |
483 | 243 | login_person(self.person) | 244 | login_person(self.person) |
484 | 244 | self.request = LaunchpadTestRequest() | 245 | self.request = LaunchpadTestRequest() |
485 | 245 | 246 | ||
486 | 246 | def tearDown(self): | 247 | def tearDown(self): |
487 | 247 | logout() | 248 | logout() |
488 | 249 | super(TestBranchAddView, self).tearDown() | ||
489 | 248 | 250 | ||
490 | 249 | def get_view(self, context): | 251 | def get_view(self, context): |
491 | 250 | view = BranchAddView(context, self.request) | 252 | view = BranchAddView(context, self.request) |
492 | 251 | 253 | ||
493 | === modified file 'lib/lp/code/mail/tests/test_codehandler.py' | |||
494 | --- lib/lp/code/mail/tests/test_codehandler.py 2009-10-23 19:33:09 +0000 | |||
495 | +++ lib/lp/code/mail/tests/test_codehandler.py 2010-01-08 04:12:19 +0000 | |||
496 | @@ -127,12 +127,13 @@ | |||
497 | 127 | layer = ZopelessAppServerLayer | 127 | layer = ZopelessAppServerLayer |
498 | 128 | 128 | ||
499 | 129 | def setUp(self): | 129 | def setUp(self): |
501 | 130 | TestCaseWithFactory.setUp(self, user='test@canonical.com') | 130 | super(TestCodeHandler, self).setUp(user='test@canonical.com') |
502 | 131 | self.code_handler = CodeHandler() | 131 | self.code_handler = CodeHandler() |
503 | 132 | self._old_policy = setSecurityPolicy(LaunchpadSecurityPolicy) | 132 | self._old_policy = setSecurityPolicy(LaunchpadSecurityPolicy) |
504 | 133 | 133 | ||
505 | 134 | def tearDown(self): | 134 | def tearDown(self): |
506 | 135 | setSecurityPolicy(self._old_policy) | 135 | setSecurityPolicy(self._old_policy) |
507 | 136 | super(TestCodeHandler, self).tearDown() | ||
508 | 136 | 137 | ||
509 | 137 | def switchDbUser(self, user): | 138 | def switchDbUser(self, user): |
510 | 138 | """Commit the transactionand switch to the new user.""" | 139 | """Commit the transactionand switch to the new user.""" |
511 | @@ -1060,6 +1061,7 @@ | |||
512 | 1060 | # We don't need no stinking layer. | 1061 | # We don't need no stinking layer. |
513 | 1061 | 1062 | ||
514 | 1062 | def setUp(self): | 1063 | def setUp(self): |
515 | 1064 | super(TestVoteEmailCommand, self).setUp() | ||
516 | 1063 | class FakeExecutionContext: | 1065 | class FakeExecutionContext: |
517 | 1064 | vote = None | 1066 | vote = None |
518 | 1065 | vote_tags = None | 1067 | vote_tags = None |
519 | @@ -1149,7 +1151,8 @@ | |||
520 | 1149 | layer = LaunchpadZopelessLayer | 1151 | layer = LaunchpadZopelessLayer |
521 | 1150 | 1152 | ||
522 | 1151 | def setUp(self): | 1153 | def setUp(self): |
524 | 1152 | TestCaseWithFactory.setUp(self, user='test@canonical.com') | 1154 | super(TestUpdateStatusEmailCommand, self).setUp( |
525 | 1155 | user='test@canonical.com') | ||
526 | 1153 | self._old_policy = setSecurityPolicy(LaunchpadSecurityPolicy) | 1156 | self._old_policy = setSecurityPolicy(LaunchpadSecurityPolicy) |
527 | 1154 | self.merge_proposal = self.factory.makeBranchMergeProposal() | 1157 | self.merge_proposal = self.factory.makeBranchMergeProposal() |
528 | 1155 | # Default the user to be the target branch owner, so they are | 1158 | # Default the user to be the target branch owner, so they are |
529 | @@ -1161,6 +1164,7 @@ | |||
530 | 1161 | 1164 | ||
531 | 1162 | def tearDown(self): | 1165 | def tearDown(self): |
532 | 1163 | setSecurityPolicy(self._old_policy) | 1166 | setSecurityPolicy(self._old_policy) |
533 | 1167 | super(TestUpdateStatusEmailCommand, self).tearDown() | ||
534 | 1164 | 1168 | ||
535 | 1165 | def test_numberOfArguments(self): | 1169 | def test_numberOfArguments(self): |
536 | 1166 | # The command needs one and only one arg. | 1170 | # The command needs one and only one arg. |
537 | @@ -1257,7 +1261,8 @@ | |||
538 | 1257 | layer = LaunchpadZopelessLayer | 1261 | layer = LaunchpadZopelessLayer |
539 | 1258 | 1262 | ||
540 | 1259 | def setUp(self): | 1263 | def setUp(self): |
542 | 1260 | TestCaseWithFactory.setUp(self, user='test@canonical.com') | 1264 | super(TestAddReviewerEmailCommand, self).setUp( |
543 | 1265 | user='test@canonical.com') | ||
544 | 1261 | self._old_policy = setSecurityPolicy(LaunchpadSecurityPolicy) | 1266 | self._old_policy = setSecurityPolicy(LaunchpadSecurityPolicy) |
545 | 1262 | self.merge_proposal = self.factory.makeBranchMergeProposal() | 1267 | self.merge_proposal = self.factory.makeBranchMergeProposal() |
546 | 1263 | # Default the user to be the target branch owner, so they are | 1268 | # Default the user to be the target branch owner, so they are |
547 | @@ -1270,6 +1275,7 @@ | |||
548 | 1270 | 1275 | ||
549 | 1271 | def tearDown(self): | 1276 | def tearDown(self): |
550 | 1272 | setSecurityPolicy(self._old_policy) | 1277 | setSecurityPolicy(self._old_policy) |
551 | 1278 | super(TestAddReviewerEmailCommand, self).tearDown() | ||
552 | 1273 | 1279 | ||
553 | 1274 | def test_numberOfArguments(self): | 1280 | def test_numberOfArguments(self): |
554 | 1275 | # The command needs at least one arg. | 1281 | # The command needs at least one arg. |
555 | 1276 | 1282 | ||
556 | === modified file 'lib/lp/code/model/tests/test_branch.py' | |||
557 | --- lib/lp/code/model/tests/test_branch.py 2009-12-11 00:56:16 +0000 | |||
558 | +++ lib/lp/code/model/tests/test_branch.py 2010-01-08 04:12:19 +0000 | |||
559 | @@ -75,6 +75,7 @@ | |||
560 | 75 | layer = LaunchpadZopelessLayer | 75 | layer = LaunchpadZopelessLayer |
561 | 76 | 76 | ||
562 | 77 | def setUp(self): | 77 | def setUp(self): |
563 | 78 | super(TestCodeImport, self).setUp() | ||
564 | 78 | login('test@canonical.com') | 79 | login('test@canonical.com') |
565 | 79 | self.factory = LaunchpadObjectFactory() | 80 | self.factory = LaunchpadObjectFactory() |
566 | 80 | 81 | ||
567 | @@ -650,6 +651,7 @@ | |||
568 | 650 | layer = LaunchpadZopelessLayer | 651 | layer = LaunchpadZopelessLayer |
569 | 651 | 652 | ||
570 | 652 | def setUp(self): | 653 | def setUp(self): |
571 | 654 | super(TestBranchDeletionConsequences, self).setUp() | ||
572 | 653 | login('test@canonical.com') | 655 | login('test@canonical.com') |
573 | 654 | self.factory = LaunchpadObjectFactory() | 656 | self.factory = LaunchpadObjectFactory() |
574 | 655 | # Has to be a product branch because of merge proposals. | 657 | # Has to be a product branch because of merge proposals. |
575 | @@ -1035,7 +1037,7 @@ | |||
576 | 1035 | layer = DatabaseFunctionalLayer | 1037 | layer = DatabaseFunctionalLayer |
577 | 1036 | 1038 | ||
578 | 1037 | def setUp(self): | 1039 | def setUp(self): |
580 | 1038 | TestCaseWithFactory.setUp(self, 'admin@canonical.com') | 1040 | super(BranchAddLandingTarget, self).setUp('admin@canonical.com') |
581 | 1039 | self.product = self.factory.makeProduct() | 1041 | self.product = self.factory.makeProduct() |
582 | 1040 | 1042 | ||
583 | 1041 | self.user = self.factory.makePerson() | 1043 | self.user = self.factory.makePerson() |
584 | @@ -1048,6 +1050,7 @@ | |||
585 | 1048 | 1050 | ||
586 | 1049 | def tearDown(self): | 1051 | def tearDown(self): |
587 | 1050 | logout() | 1052 | logout() |
588 | 1053 | super(BranchAddLandingTarget, self).tearDown() | ||
589 | 1051 | 1054 | ||
590 | 1052 | def test_junkSource(self): | 1055 | def test_junkSource(self): |
591 | 1053 | """Junk branches cannot be used as a source for merge proposals.""" | 1056 | """Junk branches cannot be used as a source for merge proposals.""" |
592 | 1054 | 1057 | ||
593 | === modified file 'lib/lp/code/model/tests/test_codereviewkarma.py' | |||
594 | --- lib/lp/code/model/tests/test_codereviewkarma.py 2009-06-25 04:06:00 +0000 | |||
595 | +++ lib/lp/code/model/tests/test_codereviewkarma.py 2010-01-08 04:12:19 +0000 | |||
596 | @@ -29,7 +29,7 @@ | |||
597 | 29 | def setUp(self): | 29 | def setUp(self): |
598 | 30 | # Use an admin to get launchpad.Edit on all the branches to easily | 30 | # Use an admin to get launchpad.Edit on all the branches to easily |
599 | 31 | # approve and reject the proposals. | 31 | # approve and reject the proposals. |
601 | 32 | TestCaseWithFactory.setUp(self, 'admin@canonical.com') | 32 | super(TestCodeReviewKarma, self).setUp('admin@canonical.com') |
602 | 33 | # The way the zope infrastructure works is that we can register | 33 | # The way the zope infrastructure works is that we can register |
603 | 34 | # subscribers easily, but there is no way to unregister them (bug | 34 | # subscribers easily, but there is no way to unregister them (bug |
604 | 35 | # 2338). TestEventListener does this with by setting a property to | 35 | # 2338). TestEventListener does this with by setting a property to |
605 | @@ -46,6 +46,7 @@ | |||
606 | 46 | 46 | ||
607 | 47 | def tearDown(self): | 47 | def tearDown(self): |
608 | 48 | self.karma_listener.unregister() | 48 | self.karma_listener.unregister() |
609 | 49 | super(TestCodeReviewKarma, self).tearDown() | ||
610 | 49 | 50 | ||
611 | 50 | def _on_karma_assigned(self, object, event): | 51 | def _on_karma_assigned(self, object, event): |
612 | 51 | # Store the karma event for checking in the test method. | 52 | # Store the karma event for checking in the test method. |
613 | 52 | 53 | ||
614 | === modified file 'lib/lp/code/model/tests/test_revisionauthor.py' | |||
615 | --- lib/lp/code/model/tests/test_revisionauthor.py 2009-06-25 04:06:00 +0000 | |||
616 | +++ lib/lp/code/model/tests/test_revisionauthor.py 2010-01-08 04:12:19 +0000 | |||
617 | @@ -33,6 +33,7 @@ | |||
618 | 33 | layer = LaunchpadZopelessLayer | 33 | layer = LaunchpadZopelessLayer |
619 | 34 | 34 | ||
620 | 35 | def setUp(self): | 35 | def setUp(self): |
621 | 36 | super(TestRevisionEmailExtraction, self).setUp() | ||
622 | 36 | LaunchpadZopelessLayer.switchDbUser(config.branchscanner.dbuser) | 37 | LaunchpadZopelessLayer.switchDbUser(config.branchscanner.dbuser) |
623 | 37 | 38 | ||
624 | 38 | def test_email_extracted_from_name(self): | 39 | def test_email_extracted_from_name(self): |
625 | @@ -132,6 +133,7 @@ | |||
626 | 132 | 133 | ||
627 | 133 | def setUp(self): | 134 | def setUp(self): |
628 | 134 | # Create a revision author that doesn't have a user yet. | 135 | # Create a revision author that doesn't have a user yet. |
629 | 136 | super(TestNewlyValidatedEmailsLinkRevisionAuthors, self).setUp() | ||
630 | 135 | launchpad_dbuser = config.launchpad.dbuser | 137 | launchpad_dbuser = config.launchpad.dbuser |
631 | 136 | LaunchpadZopelessLayer.switchDbUser(config.branchscanner.dbuser) | 138 | LaunchpadZopelessLayer.switchDbUser(config.branchscanner.dbuser) |
632 | 137 | self.author = RevisionSet()._createRevisionAuthor( | 139 | self.author = RevisionSet()._createRevisionAuthor( |
633 | @@ -171,6 +173,7 @@ | |||
634 | 171 | layer = LaunchpadZopelessLayer | 173 | layer = LaunchpadZopelessLayer |
635 | 172 | 174 | ||
636 | 173 | def setUp(self): | 175 | def setUp(self): |
637 | 176 | super(TestRevisionAuthor, self).setUp() | ||
638 | 174 | LaunchpadZopelessLayer.switchDbUser(config.branchscanner.dbuser) | 177 | LaunchpadZopelessLayer.switchDbUser(config.branchscanner.dbuser) |
639 | 175 | 178 | ||
640 | 176 | def testGetNameWithoutEmailReturnsNamePart(self): | 179 | def testGetNameWithoutEmailReturnsNamePart(self): |
641 | 177 | 180 | ||
642 | === modified file 'lib/lp/codehosting/puller/tests/test_worker.py' | |||
643 | --- lib/lp/codehosting/puller/tests/test_worker.py 2009-12-22 23:50:27 +0000 | |||
644 | +++ lib/lp/codehosting/puller/tests/test_worker.py 2010-01-08 04:12:19 +0000 | |||
645 | @@ -566,6 +566,7 @@ | |||
646 | 566 | """Tests specific to `MirroredBranchPolicy`.""" | 566 | """Tests specific to `MirroredBranchPolicy`.""" |
647 | 567 | 567 | ||
648 | 568 | def setUp(self): | 568 | def setUp(self): |
649 | 569 | super(TestMirroredBranchPolicy, self).setUp() | ||
650 | 569 | self.factory = LaunchpadObjectFactory() | 570 | self.factory = LaunchpadObjectFactory() |
651 | 570 | 571 | ||
652 | 571 | def testNoFileURL(self): | 572 | def testNoFileURL(self): |
653 | 572 | 573 | ||
654 | === modified file 'lib/lp/codehosting/tests/test_rewrite.py' | |||
655 | --- lib/lp/codehosting/tests/test_rewrite.py 2009-11-05 19:06:56 +0000 | |||
656 | +++ lib/lp/codehosting/tests/test_rewrite.py 2010-01-08 04:12:19 +0000 | |||
657 | @@ -28,7 +28,7 @@ | |||
658 | 28 | layer = DatabaseFunctionalLayer | 28 | layer = DatabaseFunctionalLayer |
659 | 29 | 29 | ||
660 | 30 | def setUp(self): | 30 | def setUp(self): |
662 | 31 | TestCaseWithFactory.setUp(self) | 31 | super(TestBranchRewriter, self).setUp() |
663 | 32 | self.fake_time = FakeTime(0) | 32 | self.fake_time = FakeTime(0) |
664 | 33 | 33 | ||
665 | 34 | def makeRewriter(self): | 34 | def makeRewriter(self): |
666 | 35 | 35 | ||
667 | === modified file 'lib/lp/registry/tests/test_distroseries.py' | |||
668 | --- lib/lp/registry/tests/test_distroseries.py 2009-08-28 07:34:44 +0000 | |||
669 | +++ lib/lp/registry/tests/test_distroseries.py 2010-01-08 04:12:19 +0000 | |||
670 | @@ -34,6 +34,7 @@ | |||
671 | 34 | 34 | ||
672 | 35 | def setUp(self): | 35 | def setUp(self): |
673 | 36 | # Log in as an admin, so that we can create distributions. | 36 | # Log in as an admin, so that we can create distributions. |
674 | 37 | super(TestDistroSeriesCurrentSourceReleases, self).setUp() | ||
675 | 37 | login('foo.bar@canonical.com') | 38 | login('foo.bar@canonical.com') |
676 | 38 | self.publisher = SoyuzTestPublisher() | 39 | self.publisher = SoyuzTestPublisher() |
677 | 39 | self.factory = self.publisher.factory | 40 | self.factory = self.publisher.factory |
678 | 40 | 41 | ||
679 | === modified file 'lib/lp/registry/tests/test_prf_walker.py' | |||
680 | --- lib/lp/registry/tests/test_prf_walker.py 2009-07-17 18:46:25 +0000 | |||
681 | +++ lib/lp/registry/tests/test_prf_walker.py 2010-01-08 04:12:19 +0000 | |||
682 | @@ -177,6 +177,7 @@ | |||
683 | 177 | 177 | ||
684 | 178 | def tearDown(self): | 178 | def tearDown(self): |
685 | 179 | reset_logging() | 179 | reset_logging() |
686 | 180 | super(WalkerBase_walk, self).tearDown() | ||
687 | 180 | 181 | ||
688 | 181 | def test_walk_UnicodeEncodeError(self): | 182 | def test_walk_UnicodeEncodeError(self): |
689 | 182 | """Verify that a UnicodeEncodeError is logged.""" | 183 | """Verify that a UnicodeEncodeError is logged.""" |
690 | @@ -311,6 +312,7 @@ | |||
691 | 311 | 312 | ||
692 | 312 | def tearDown(self): | 313 | def tearDown(self): |
693 | 313 | reset_logging() | 314 | reset_logging() |
694 | 315 | super(HTTPWalker_ListDir, self).tearDown() | ||
695 | 314 | 316 | ||
696 | 315 | def setUpWalker(self, listing_url, listing_content): | 317 | def setUpWalker(self, listing_url, listing_content): |
697 | 316 | from lp.registry.scripts.productreleasefinder.walker import ( | 318 | from lp.registry.scripts.productreleasefinder.walker import ( |
698 | @@ -487,6 +489,7 @@ | |||
699 | 487 | 489 | ||
700 | 488 | def tearDown(self): | 490 | def tearDown(self): |
701 | 489 | reset_logging() | 491 | reset_logging() |
702 | 492 | super(HTTPWalker_IsDirectory, self).tearDown() | ||
703 | 490 | 493 | ||
704 | 491 | def testFtpIsDirectory(self): | 494 | def testFtpIsDirectory(self): |
705 | 492 | # Test that no requests are made by isDirectory() when walking | 495 | # Test that no requests are made by isDirectory() when walking |
706 | 493 | 496 | ||
707 | === modified file 'lib/lp/scripts/utilities/tests/test_sanitizedb.py' | |||
708 | --- lib/lp/scripts/utilities/tests/test_sanitizedb.py 2009-10-01 03:54:04 +0000 | |||
709 | +++ lib/lp/scripts/utilities/tests/test_sanitizedb.py 2010-01-08 04:12:19 +0000 | |||
710 | @@ -20,6 +20,7 @@ | |||
711 | 20 | layer = DatabaseLayer | 20 | layer = DatabaseLayer |
712 | 21 | 21 | ||
713 | 22 | def setUp(self): | 22 | def setUp(self): |
714 | 23 | super(SanitizeDbScriptTestCase, self).setUp() | ||
715 | 23 | self.script_path = os.path.join( | 24 | self.script_path = os.path.join( |
716 | 24 | config.root, 'utilities', 'sanitize-db.py') | 25 | config.root, 'utilities', 'sanitize-db.py') |
717 | 25 | DatabaseLayer.force_dirty_database() | 26 | DatabaseLayer.force_dirty_database() |
718 | 26 | 27 | ||
719 | === modified file 'lib/lp/services/apachelogparser/tests/test_apachelogparser.py' | |||
720 | --- lib/lp/services/apachelogparser/tests/test_apachelogparser.py 2009-11-17 18:36:20 +0000 | |||
721 | +++ lib/lp/services/apachelogparser/tests/test_apachelogparser.py 2010-01-08 04:12:19 +0000 | |||
722 | @@ -230,6 +230,7 @@ | |||
723 | 230 | root = os.path.join(here, 'apache-log-files') | 230 | root = os.path.join(here, 'apache-log-files') |
724 | 231 | 231 | ||
725 | 232 | def setUp(self): | 232 | def setUp(self): |
726 | 233 | super(TestParsedFilesDetection, self).setUp() | ||
727 | 233 | self.layer.switchDbUser(DBUSER) | 234 | self.layer.switchDbUser(DBUSER) |
728 | 234 | 235 | ||
729 | 235 | def test_not_parsed_file(self): | 236 | def test_not_parsed_file(self): |
730 | @@ -301,6 +302,7 @@ | |||
731 | 301 | layer = LaunchpadZopelessLayer | 302 | layer = LaunchpadZopelessLayer |
732 | 302 | 303 | ||
733 | 303 | def setUp(self): | 304 | def setUp(self): |
734 | 305 | super(Test_create_or_update_parsedlog_entry, self).setUp() | ||
735 | 304 | self.layer.switchDbUser(DBUSER) | 306 | self.layer.switchDbUser(DBUSER) |
736 | 305 | 307 | ||
737 | 306 | def test_creation_of_new_entries(self): | 308 | def test_creation_of_new_entries(self): |
738 | 307 | 309 | ||
739 | === modified file 'lib/lp/services/database/tests/test_prejoin.py' | |||
740 | --- lib/lp/services/database/tests/test_prejoin.py 2009-10-28 12:38:31 +0000 | |||
741 | +++ lib/lp/services/database/tests/test_prejoin.py 2010-01-08 04:12:19 +0000 | |||
742 | @@ -20,6 +20,7 @@ | |||
743 | 20 | layer = LaunchpadZopelessLayer | 20 | layer = LaunchpadZopelessLayer |
744 | 21 | 21 | ||
745 | 22 | def setUp(self): | 22 | def setUp(self): |
746 | 23 | super(PrejoinTestCase, self).setUp() | ||
747 | 23 | self.store = IMasterStore(Product) | 24 | self.store = IMasterStore(Product) |
748 | 24 | 25 | ||
749 | 25 | # All products | 26 | # All products |
750 | 26 | 27 | ||
751 | === modified file 'lib/lp/services/mail/tests/test_mailbox.py' | |||
752 | --- lib/lp/services/mail/tests/test_mailbox.py 2009-06-30 16:56:07 +0000 | |||
753 | +++ lib/lp/services/mail/tests/test_mailbox.py 2010-01-08 04:12:19 +0000 | |||
754 | @@ -19,12 +19,10 @@ | |||
755 | 19 | class TestDirectoryMailBox(TestCase): | 19 | class TestDirectoryMailBox(TestCase): |
756 | 20 | 20 | ||
757 | 21 | def setUp(self): | 21 | def setUp(self): |
758 | 22 | super(TestDirectoryMailBox, self).setUp() | ||
759 | 22 | # Create a temp directory. | 23 | # Create a temp directory. |
760 | 23 | self.email_dir = tempfile.mkdtemp() | 24 | self.email_dir = tempfile.mkdtemp() |
765 | 24 | 25 | self.addCleanup(rmtree, self.email_dir) | |
762 | 25 | def tearDown(self): | ||
763 | 26 | # Delete the directory. | ||
764 | 27 | rmtree(self.email_dir) | ||
766 | 28 | 26 | ||
767 | 29 | def test_verify_interface(self): | 27 | def test_verify_interface(self): |
768 | 30 | # Make sure that the object actually implements the interface. | 28 | # Make sure that the object actually implements the interface. |
769 | 31 | 29 | ||
770 | === modified file 'lib/lp/services/memcache/tests/test_memcache_client.py' | |||
771 | --- lib/lp/services/memcache/tests/test_memcache_client.py 2009-10-15 13:04:44 +0000 | |||
772 | +++ lib/lp/services/memcache/tests/test_memcache_client.py 2010-01-08 04:12:19 +0000 | |||
773 | @@ -18,6 +18,7 @@ | |||
774 | 18 | layer = LaunchpadZopelessLayer | 18 | layer = LaunchpadZopelessLayer |
775 | 19 | 19 | ||
776 | 20 | def setUp(self): | 20 | def setUp(self): |
777 | 21 | super(MemcacheClientTestCase, self).setUp() | ||
778 | 21 | self.client = getUtility(IMemcacheClient) | 22 | self.client = getUtility(IMemcacheClient) |
779 | 22 | 23 | ||
780 | 23 | def test_basics(self): | 24 | def test_basics(self): |
781 | 24 | 25 | ||
782 | === modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py' | |||
783 | --- lib/lp/soyuz/scripts/tests/test_copypackage.py 2009-12-21 12:54:47 +0000 | |||
784 | +++ lib/lp/soyuz/scripts/tests/test_copypackage.py 2010-01-08 04:12:19 +0000 | |||
785 | @@ -1236,6 +1236,7 @@ | |||
786 | 1236 | The records annotated will be excluded during the operation checks, | 1236 | The records annotated will be excluded during the operation checks, |
787 | 1237 | see checkCopies(). | 1237 | see checkCopies(). |
788 | 1238 | """ | 1238 | """ |
789 | 1239 | super(CopyPackageTestCase, self).setUp() | ||
790 | 1239 | pending_sources = SecureSourcePackagePublishingHistory.selectBy( | 1240 | pending_sources = SecureSourcePackagePublishingHistory.selectBy( |
791 | 1240 | status=PackagePublishingStatus.PENDING) | 1241 | status=PackagePublishingStatus.PENDING) |
792 | 1241 | self.sources_pending_ids = [pub.id for pub in pending_sources] | 1242 | self.sources_pending_ids = [pub.id for pub in pending_sources] |
793 | 1242 | 1243 | ||
794 | === modified file 'lib/lp/translations/scripts/tests/test_remove_translations.py' | |||
795 | --- lib/lp/translations/scripts/tests/test_remove_translations.py 2009-10-17 14:06:03 +0000 | |||
796 | +++ lib/lp/translations/scripts/tests/test_remove_translations.py 2010-01-08 04:12:19 +0000 | |||
797 | @@ -45,6 +45,7 @@ | |||
798 | 45 | layer = LaunchpadZopelessLayer | 45 | layer = LaunchpadZopelessLayer |
799 | 46 | 46 | ||
800 | 47 | def setUp(self): | 47 | def setUp(self): |
801 | 48 | super(TestRemoveTranslationsConstraints, self).setUp() | ||
802 | 48 | # Acquire privileges to delete TranslationMessages. We won't | 49 | # Acquire privileges to delete TranslationMessages. We won't |
803 | 49 | # actually do that here, but we'll go through all the motions. | 50 | # actually do that here, but we'll go through all the motions. |
804 | 50 | self.layer.switchDbUser('postgres') | 51 | self.layer.switchDbUser('postgres') |
805 | @@ -155,6 +156,7 @@ | |||
806 | 155 | layer = LaunchpadZopelessLayer | 156 | layer = LaunchpadZopelessLayer |
807 | 156 | 157 | ||
808 | 157 | def setUp(self): | 158 | def setUp(self): |
809 | 159 | super(TestRemoveTranslationsOptionsHandling, self).setUp() | ||
810 | 158 | self.factory = LaunchpadObjectFactory() | 160 | self.factory = LaunchpadObjectFactory() |
811 | 159 | 161 | ||
812 | 160 | def test_WithNativeArgs(self): | 162 | def test_WithNativeArgs(self): |
813 | @@ -222,6 +224,7 @@ | |||
814 | 222 | layer = LaunchpadZopelessLayer | 224 | layer = LaunchpadZopelessLayer |
815 | 223 | 225 | ||
816 | 224 | def setUp(self): | 226 | def setUp(self): |
817 | 227 | super(TestRemoveTranslations, self).setUp() | ||
818 | 225 | # Acquire privileges to delete TranslationMessages. That's not | 228 | # Acquire privileges to delete TranslationMessages. That's not |
819 | 226 | # something we normally do. Actually we should test under | 229 | # something we normally do. Actually we should test under |
820 | 227 | # rosettaadmin, but that user does not have all the privileges | 230 | # rosettaadmin, but that user does not have all the privileges |
821 | @@ -553,6 +556,7 @@ | |||
822 | 553 | layer = LaunchpadZopelessLayer | 556 | layer = LaunchpadZopelessLayer |
823 | 554 | 557 | ||
824 | 555 | def setUp(self): | 558 | def setUp(self): |
825 | 559 | super(TestRemoveTranslationsUnmasking, self).setUp() | ||
826 | 556 | self.layer.switchDbUser('postgres') | 560 | self.layer.switchDbUser('postgres') |
827 | 557 | 561 | ||
828 | 558 | # Set up a template with a Laotian translation file. There's | 562 | # Set up a template with a Laotian translation file. There's |
This branch is pretty simple in intent. It goes through many, many test cases and makes them upcall setUp and tearDown.
It's a prequisite for using testtools, which mandates upcalling setUp & tearDown to avoid more painful errors.
I've also changed a lot of the upcalls to be new-style.