Merge lp:~dobey/ubuntuone-dev-tools/update-4-2 into lp:ubuntuone-dev-tools/stable-4-2
- update-4-2
- Merge into stable-4-2
Proposed by
dobey
Status: | Merged |
---|---|
Merged at revision: | 99 |
Proposed branch: | lp:~dobey/ubuntuone-dev-tools/update-4-2 |
Merge into: | lp:ubuntuone-dev-tools/stable-4-2 |
Diff against target: |
723 lines (+121/-111) 19 files modified
bin/u1lint (+9/-11) setup.py (+3/-4) ubuntuone/devtools/handlers.py (+3/-3) ubuntuone/devtools/runners/__init__.py (+1/-1) ubuntuone/devtools/services/__init__.py (+3/-3) ubuntuone/devtools/services/dbus.py (+1/-1) ubuntuone/devtools/services/squid.py (+10/-9) ubuntuone/devtools/services/tests/test_dbus.py (+5/-5) ubuntuone/devtools/services/tests/test_squid.py (+9/-8) ubuntuone/devtools/testcases/__init__.py (+3/-3) ubuntuone/devtools/testcases/dbus.py (+2/-2) ubuntuone/devtools/testcases/tests/test_squid_testcase.py (+19/-13) ubuntuone/devtools/testcases/tests/test_txsocketserver.py (+14/-14) ubuntuone/devtools/testcases/txsocketserver.py (+17/-15) ubuntuone/devtools/testing/tests/test_txwebserver.py (+6/-4) ubuntuone/devtools/testing/txcheck.py (+6/-6) ubuntuone/devtools/testing/txwebserver.py (+6/-5) ubuntuone/devtools/tests/test_decorators.py (+1/-1) ubuntuone/devtools/tests/test_txcheck.py (+3/-3) |
To merge this branch: | bzr merge lp:~dobey/ubuntuone-dev-tools/update-4-2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Roberto Alsina (community) | Approve | ||
Review via email: mp+137057@code.launchpad.net |
Commit message
Fix pep8 warnings that are newly presented in pep8 1.3
Description of the change
To post a comment you must log in.
Revision history for this message
Roberto Alsina (ralsina) : | # |
review:
Approve
Revision history for this message
Ubuntu One Auto Pilot (otto-pilot) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'bin/u1lint' | |||
2 | --- bin/u1lint 2012-10-18 21:17:22 +0000 | |||
3 | +++ bin/u1lint 2012-11-29 21:41:22 +0000 | |||
4 | @@ -162,7 +162,7 @@ | |||
5 | 162 | 162 | ||
6 | 163 | # pylint: disable=E1103 | 163 | # pylint: disable=E1103 |
7 | 164 | return [os.path.join(SRCDIR, item) for item in | 164 | return [os.path.join(SRCDIR, item) for item in |
9 | 165 | config.get("MASTER", "ignore").split(",")] | 165 | config.get("MASTER", "ignore").split(",")] |
10 | 166 | except (TypeError, configparser.NoOptionError): | 166 | except (TypeError, configparser.NoOptionError): |
11 | 167 | return [] | 167 | return [] |
12 | 168 | # pylint: enable=E1103 | 168 | # pylint: enable=E1103 |
13 | @@ -210,15 +210,13 @@ | |||
14 | 210 | continue | 210 | continue |
15 | 211 | 211 | ||
16 | 212 | # Skip protobuf-generated and backup files | 212 | # Skip protobuf-generated and backup files |
21 | 213 | if (filename.endswith("_pb2.py") | 213 | if filename.endswith("_pb2.py") \ |
22 | 214 | or filename.endswith("~") | 214 | or filename.endswith("~") \ |
23 | 215 | or filename.endswith(".bat") | 215 | or filename.endswith(".bat"): |
20 | 216 | ): | ||
24 | 217 | continue | 216 | continue |
25 | 218 | 217 | ||
29 | 219 | if (filename.endswith(".py") | 218 | if filename.endswith(".py") \ |
30 | 220 | or filepath.endswith("bin" + os.path.sep) | 219 | or filepath.endswith("bin" + os.path.sep): |
28 | 221 | ): | ||
31 | 222 | pyfiles.append(os.path.join(root, filename)) | 220 | pyfiles.append(os.path.join(root, filename)) |
32 | 223 | 221 | ||
33 | 224 | pyfiles.sort() | 222 | pyfiles.sort() |
34 | @@ -231,14 +229,14 @@ | |||
35 | 231 | usage = '%prog [options]' | 229 | usage = '%prog [options]' |
36 | 232 | parser = OptionParser(usage=usage) | 230 | parser = OptionParser(usage=usage) |
37 | 233 | parser.add_option('-i', '--ignore', dest='ignored', default=None, | 231 | parser.add_option('-i', '--ignore', dest='ignored', default=None, |
39 | 234 | help='comma-separated paths or files, to ignore') | 232 | help='comma-separated paths or files, to ignore') |
40 | 235 | (options, args) = parser.parse_args() | 233 | (options, args) = parser.parse_args() |
41 | 236 | 234 | ||
42 | 237 | failed = False | 235 | failed = False |
43 | 238 | ignored = _read_pylintrc_ignored() | 236 | ignored = _read_pylintrc_ignored() |
44 | 239 | if options.ignored: | 237 | if options.ignored: |
45 | 240 | ignored.extend([os.path.join(SRCDIR, item) for item in | 238 | ignored.extend([os.path.join(SRCDIR, item) for item in |
47 | 241 | map(str.strip, options.ignored.split(','))]) | 239 | map(str.strip, options.ignored.split(','))]) |
48 | 242 | 240 | ||
49 | 243 | if os.environ.get('USE_PYFLAKES'): | 241 | if os.environ.get('USE_PYFLAKES'): |
50 | 244 | pylint_args = get_subprocess_start_info('pyflakes') | 242 | pylint_args = get_subprocess_start_info('pyflakes') |
51 | @@ -246,7 +244,7 @@ | |||
52 | 246 | pylint_args = get_subprocess_start_info('pylint') | 244 | pylint_args = get_subprocess_start_info('pylint') |
53 | 247 | # append the extra args to the start info | 245 | # append the extra args to the start info |
54 | 248 | pylint_args.extend(['--output-format=parseable', | 246 | pylint_args.extend(['--output-format=parseable', |
56 | 249 | '--include-ids=yes']) | 247 | '--include-ids=yes']) |
57 | 250 | if PYLINTRC: | 248 | if PYLINTRC: |
58 | 251 | pylint_args.append("--rcfile=" + PYLINTRC) | 249 | pylint_args.append("--rcfile=" + PYLINTRC) |
59 | 252 | 250 | ||
60 | 253 | 251 | ||
61 | === modified file 'setup.py' | |||
62 | --- setup.py 2012-07-26 21:13:55 +0000 | |||
63 | +++ setup.py 2012-11-29 21:41:22 +0000 | |||
64 | @@ -80,7 +80,7 @@ | |||
65 | 80 | ('share/man/man1', | 80 | ('share/man/man1', |
66 | 81 | ['man/u1lint.1', | 81 | ['man/u1lint.1', |
67 | 82 | 'man/u1trial.1']), | 82 | 'man/u1trial.1']), |
69 | 83 | ] | 83 | ] |
70 | 84 | 84 | ||
71 | 85 | setup(name=PACKAGE, | 85 | setup(name=PACKAGE, |
72 | 86 | version=VERSION, | 86 | version=VERSION, |
73 | @@ -96,7 +96,6 @@ | |||
74 | 96 | extra_path='ubuntuone-dev-tools', | 96 | extra_path='ubuntuone-dev-tools', |
75 | 97 | scripts=scripts, | 97 | scripts=scripts, |
76 | 98 | data_files=DATA_FILES, | 98 | data_files=DATA_FILES, |
80 | 99 | cmdclass={ | 99 | cmdclass={'lint': Lint, |
81 | 100 | 'lint': Lint, | 100 | }, |
79 | 101 | }, | ||
82 | 102 | ) | 101 | ) |
83 | 103 | 102 | ||
84 | === modified file 'ubuntuone/devtools/handlers.py' | |||
85 | --- ubuntuone/devtools/handlers.py 2012-08-20 22:15:07 +0000 | |||
86 | +++ ubuntuone/devtools/handlers.py 2012-11-29 21:41:22 +0000 | |||
87 | @@ -90,8 +90,8 @@ | |||
88 | 90 | def check_exception(self, exception_info, *msgs): | 90 | def check_exception(self, exception_info, *msgs): |
89 | 91 | """Shortcut for checking exceptions.""" | 91 | """Shortcut for checking exceptions.""" |
90 | 92 | for rec in self.records: | 92 | for rec in self.records: |
94 | 93 | if (rec.levelno == logging.ERROR and | 93 | if rec.levelno == logging.ERROR and \ |
95 | 94 | all(m in rec.exc_text + rec.message for m in msgs) and | 94 | all(m in rec.exc_text + rec.message for m in msgs) and \ |
96 | 95 | exception_info in rec.exc_info): | 95 | exception_info in rec.exc_info: |
97 | 96 | return True | 96 | return True |
98 | 97 | return False | 97 | return False |
99 | 98 | 98 | ||
100 | === modified file 'ubuntuone/devtools/runners/__init__.py' | |||
101 | --- ubuntuone/devtools/runners/__init__.py 2012-09-28 13:58:23 +0000 | |||
102 | +++ ubuntuone/devtools/runners/__init__.py 2012-11-29 21:41:22 +0000 | |||
103 | @@ -151,7 +151,7 @@ | |||
104 | 151 | for test in files: | 151 | for test in files: |
105 | 152 | filepath = os.path.join(root, test) | 152 | filepath = os.path.join(root, test) |
106 | 153 | if test.endswith(".py") and test not in ignored_modules and \ | 153 | if test.endswith(".py") and test not in ignored_modules and \ |
108 | 154 | not _is_in_ignored_path(filepath, ignored_paths): | 154 | not _is_in_ignored_path(filepath, ignored_paths): |
109 | 155 | self.source_files.append(filepath) | 155 | self.source_files.append(filepath) |
110 | 156 | if test.startswith("test_"): | 156 | if test.startswith("test_"): |
111 | 157 | module_suite = self._load_unittest(filepath) | 157 | module_suite = self._load_unittest(filepath) |
112 | 158 | 158 | ||
113 | === modified file 'ubuntuone/devtools/services/__init__.py' | |||
114 | --- ubuntuone/devtools/services/__init__.py 2012-04-25 10:27:12 +0000 | |||
115 | +++ ubuntuone/devtools/services/__init__.py 2012-11-29 21:41:22 +0000 | |||
116 | @@ -37,9 +37,9 @@ | |||
117 | 37 | """Find the first appropriate conf to use.""" | 37 | """Find the first appropriate conf to use.""" |
118 | 38 | # In case we're running from within the source tree | 38 | # In case we're running from within the source tree |
119 | 39 | path = os.path.abspath(os.path.join(os.path.dirname(__file__), | 39 | path = os.path.abspath(os.path.join(os.path.dirname(__file__), |
123 | 40 | os.path.pardir, os.path.pardir, | 40 | os.path.pardir, os.path.pardir, |
124 | 41 | os.path.pardir, | 41 | os.path.pardir, |
125 | 42 | "data", in_config_file)) | 42 | "data", in_config_file)) |
126 | 43 | if not os.path.exists(path): | 43 | if not os.path.exists(path): |
127 | 44 | # Use the installed file in $pkgdatadir as source | 44 | # Use the installed file in $pkgdatadir as source |
128 | 45 | for path in load_data_paths("ubuntuone-dev-tools", | 45 | for path in load_data_paths("ubuntuone-dev-tools", |
129 | 46 | 46 | ||
130 | === modified file 'ubuntuone/devtools/services/dbus.py' | |||
131 | --- ubuntuone/devtools/services/dbus.py 2012-08-28 21:28:15 +0000 | |||
132 | +++ ubuntuone/devtools/services/dbus.py 2012-11-29 21:41:22 +0000 | |||
133 | @@ -103,7 +103,7 @@ | |||
134 | 103 | 103 | ||
135 | 104 | if self.dbus_address != "": | 104 | if self.dbus_address != "": |
136 | 105 | os.environ["DBUS_SESSION_BUS_ADDRESS"] = \ | 105 | os.environ["DBUS_SESSION_BUS_ADDRESS"] = \ |
138 | 106 | self.dbus_address.decode("utf8") | 106 | self.dbus_address.decode("utf8") |
139 | 107 | else: | 107 | else: |
140 | 108 | os.kill(self.dbus_pid, signal.SIGKILL) | 108 | os.kill(self.dbus_pid, signal.SIGKILL) |
141 | 109 | raise DBusLaunchError("There was a problem launching dbus-daemon.") | 109 | raise DBusLaunchError("There was a problem launching dbus-daemon.") |
142 | 110 | 110 | ||
143 | === modified file 'ubuntuone/devtools/services/squid.py' | |||
144 | --- ubuntuone/devtools/services/squid.py 2012-08-20 21:20:50 +0000 | |||
145 | +++ ubuntuone/devtools/services/squid.py 2012-11-29 21:41:22 +0000 | |||
146 | @@ -225,13 +225,14 @@ | |||
147 | 225 | spool_path = _get_spool_temp_path(tempdir) | 225 | spool_path = _get_spool_temp_path(tempdir) |
148 | 226 | squid_path = _get_squid_temp_path(tempdir) | 226 | squid_path = _get_squid_temp_path(tempdir) |
149 | 227 | with open(self.config_file, 'w') as out_file: | 227 | with open(self.config_file, 'w') as out_file: |
157 | 228 | out_file.write(template.safe_substitute( | 228 | out_file.write( |
158 | 229 | auth_file=self.auth_file, | 229 | template.safe_substitute( |
159 | 230 | auth_process=self.auth_process, | 230 | auth_file=self.auth_file, |
160 | 231 | noauth_port_number=self.settings['noauth_port'], | 231 | auth_process=self.auth_process, |
161 | 232 | auth_port_number=self.settings['auth_port'], | 232 | noauth_port_number=self.settings['noauth_port'], |
162 | 233 | spool_temp=spool_path, | 233 | auth_port_number=self.settings['auth_port'], |
163 | 234 | squid_temp=squid_path)) | 234 | spool_temp=spool_path, |
164 | 235 | squid_temp=squid_path)) | ||
165 | 235 | 236 | ||
166 | 236 | def _generate_swap(self, config_file): | 237 | def _generate_swap(self, config_file): |
167 | 237 | """Generate the squid swap files.""" | 238 | """Generate the squid swap files.""" |
168 | @@ -271,8 +272,8 @@ | |||
169 | 271 | try: | 272 | try: |
170 | 272 | # Do not use stdout=PIPE or stderr=PIPE with this function. | 273 | # Do not use stdout=PIPE or stderr=PIPE with this function. |
171 | 273 | subprocess.check_call([self.squid] + squid_args, | 274 | subprocess.check_call([self.squid] + squid_args, |
174 | 274 | stdout=subprocess.PIPE, | 275 | stdout=subprocess.PIPE, |
175 | 275 | stderr=subprocess.PIPE) | 276 | stderr=subprocess.PIPE) |
176 | 276 | return True | 277 | return True |
177 | 277 | except subprocess.CalledProcessError: | 278 | except subprocess.CalledProcessError: |
178 | 278 | message += '.' | 279 | message += '.' |
179 | 279 | 280 | ||
180 | === modified file 'ubuntuone/devtools/services/tests/test_dbus.py' | |||
181 | --- ubuntuone/devtools/services/tests/test_dbus.py 2012-08-20 22:10:29 +0000 | |||
182 | +++ ubuntuone/devtools/services/tests/test_dbus.py 2012-11-29 21:41:22 +0000 | |||
183 | @@ -47,14 +47,14 @@ | |||
184 | 47 | def test_dbus_session_is_running(self): | 47 | def test_dbus_session_is_running(self): |
185 | 48 | """Test that dbus session is the private one we started.""" | 48 | """Test that dbus session is the private one we started.""" |
186 | 49 | bus_address = os.environ.get('DBUS_SESSION_BUS_ADDRESS', None) | 49 | bus_address = os.environ.get('DBUS_SESSION_BUS_ADDRESS', None) |
190 | 50 | self.assertEqual(os.path.dirname( | 50 | self.assertEqual( |
191 | 51 | unquote(bus_address.split(',')[0].split('=')[1])), | 51 | os.path.dirname(unquote(bus_address.split(',')[0].split('=')[1])), |
192 | 52 | os.path.dirname(os.getcwd())) | 52 | os.path.dirname(os.getcwd())) |
193 | 53 | 53 | ||
194 | 54 | def test_config_file_path(self): | 54 | def test_config_file_path(self): |
195 | 55 | """Test that we loaded the config file from the local tree.""" | 55 | """Test that we loaded the config file from the local tree.""" |
198 | 56 | expected = os.path.abspath(os.path.join( | 56 | expected = os.path.abspath( |
199 | 57 | self.tmpdir, 'dbus-session.conf')) | 57 | os.path.join(self.tmpdir, 'dbus-session.conf')) |
200 | 58 | runner = DBusRunner() | 58 | runner = DBusRunner() |
201 | 59 | # pylint: disable=W0212 | 59 | # pylint: disable=W0212 |
202 | 60 | os.makedirs(self.tmpdir) | 60 | os.makedirs(self.tmpdir) |
203 | 61 | 61 | ||
204 | === modified file 'ubuntuone/devtools/services/tests/test_squid.py' | |||
205 | --- ubuntuone/devtools/services/tests/test_squid.py 2012-09-06 19:02:51 +0000 | |||
206 | +++ ubuntuone/devtools/services/tests/test_squid.py 2012-11-29 21:41:22 +0000 | |||
207 | @@ -187,7 +187,7 @@ | |||
208 | 187 | squid.store_proxy_settings(self.settings) | 187 | squid.store_proxy_settings(self.settings) |
209 | 188 | self.assertTrue(('dumps', self.settings) in self.called) | 188 | self.assertTrue(('dumps', self.settings) in self.called) |
210 | 189 | self.assertEqual(self.env[squid.PROXY_ENV_VAR], | 189 | self.assertEqual(self.env[squid.PROXY_ENV_VAR], |
212 | 190 | json.dumps(self.settings)) | 190 | json.dumps(self.settings)) |
213 | 191 | 191 | ||
214 | 192 | def test_retrieve_proxy_settings(self): | 192 | def test_retrieve_proxy_settings(self): |
215 | 193 | """Test reading the settings.""" | 193 | """Test reading the settings.""" |
216 | @@ -223,7 +223,7 @@ | |||
217 | 223 | """Perform the assertion when a bin is missing.""" | 223 | """Perform the assertion when a bin is missing.""" |
218 | 224 | self.assertRaises(squid.SquidLaunchError, squid.SquidRunner) | 224 | self.assertRaises(squid.SquidLaunchError, squid.SquidRunner) |
219 | 225 | self.assertTrue(('fake_find_executable', binary) in self.called, | 225 | self.assertTrue(('fake_find_executable', binary) in self.called, |
221 | 226 | self.called) | 226 | self.called) |
222 | 227 | 227 | ||
223 | 228 | def test_squid_missing(self): | 228 | def test_squid_missing(self): |
224 | 229 | """Test when squid is missing.""" | 229 | """Test when squid is missing.""" |
225 | @@ -352,12 +352,13 @@ | |||
226 | 352 | self.runner._generate_config_file(self.tmpdir) | 352 | self.runner._generate_config_file(self.tmpdir) |
227 | 353 | # remove the generated file | 353 | # remove the generated file |
228 | 354 | self.addCleanup(os.unlink, self.runner.config_file) | 354 | self.addCleanup(os.unlink, self.runner.config_file) |
235 | 355 | expected_parameters = ('safe_substitute', (), | 355 | expected_parameters = \ |
236 | 356 | dict(auth_file=self.runner.auth_file, | 356 | ('safe_substitute', (), |
237 | 357 | noauth_port_number=self.port, | 357 | dict(auth_file=self.runner.auth_file, |
238 | 358 | auth_port_number=self.port, | 358 | noauth_port_number=self.port, |
239 | 359 | spool_temp=squid._get_spool_temp_path(self.tmpdir), | 359 | auth_port_number=self.port, |
240 | 360 | squid_temp=squid._get_squid_temp_path(self.tmpdir))) | 360 | spool_temp=squid._get_spool_temp_path(self.tmpdir), |
241 | 361 | squid_temp=squid._get_squid_temp_path(self.tmpdir))) | ||
242 | 361 | self.assertTrue(expected_parameters, self.template.called[0]) | 362 | self.assertTrue(expected_parameters, self.template.called[0]) |
243 | 362 | self.assertEqual(2, self.called.count(('fake_get_port',))) | 363 | self.assertEqual(2, self.called.count(('fake_get_port',))) |
244 | 363 | 364 | ||
245 | 364 | 365 | ||
246 | === modified file 'ubuntuone/devtools/testcases/__init__.py' | |||
247 | --- ubuntuone/devtools/testcases/__init__.py 2012-08-21 21:19:41 +0000 | |||
248 | +++ ubuntuone/devtools/testcases/__init__.py 2012-11-29 21:41:22 +0000 | |||
249 | @@ -64,7 +64,7 @@ | |||
250 | 64 | def decorator(test_item): | 64 | def decorator(test_item): |
251 | 65 | """Decorate the test so that it is skipped.""" | 65 | """Decorate the test so that it is skipped.""" |
252 | 66 | if not (isinstance(test_item, type) and | 66 | if not (isinstance(test_item, type) and |
254 | 67 | issubclass(test_item, TestCase)): | 67 | issubclass(test_item, TestCase)): |
255 | 68 | 68 | ||
256 | 69 | @wraps(test_item) | 69 | @wraps(test_item) |
257 | 70 | def skip_wrapper(*args, **kwargs): | 70 | def skip_wrapper(*args, **kwargs): |
258 | @@ -106,8 +106,8 @@ | |||
259 | 106 | def skipIfNotOS(current_os, reason): | 106 | def skipIfNotOS(current_os, reason): |
260 | 107 | """Skip test we are not in a particular os.""" | 107 | """Skip test we are not in a particular os.""" |
261 | 108 | if os: | 108 | if os: |
264 | 109 | if sys.platform not in current_os or\ | 109 | if sys.platform not in current_os or \ |
265 | 110 | sys.platform != current_os: | 110 | sys.platform != current_os: |
266 | 111 | return skipTest(reason) | 111 | return skipTest(reason) |
267 | 112 | return _id | 112 | return _id |
268 | 113 | return _id | 113 | return _id |
269 | 114 | 114 | ||
270 | === modified file 'ubuntuone/devtools/testcases/dbus.py' | |||
271 | --- ubuntuone/devtools/testcases/dbus.py 2012-10-18 21:17:22 +0000 | |||
272 | +++ ubuntuone/devtools/testcases/dbus.py 2012-11-29 21:41:22 +0000 | |||
273 | @@ -71,7 +71,7 @@ | |||
274 | 71 | 71 | ||
275 | 72 | 72 | ||
276 | 73 | @skipIf(dbus is None or service is None or DBusGMainLoop is None, | 73 | @skipIf(dbus is None or service is None or DBusGMainLoop is None, |
278 | 74 | "The test requires dbus.") | 74 | "The test requires dbus.") |
279 | 75 | class DBusTestCase(BaseTestCase): | 75 | class DBusTestCase(BaseTestCase): |
280 | 76 | """Test the DBus event handling.""" | 76 | """Test the DBus event handling.""" |
281 | 77 | 77 | ||
282 | @@ -110,7 +110,7 @@ | |||
283 | 110 | # str instead of anything from ubuntuone.devtools.compat. dbus | 110 | # str instead of anything from ubuntuone.devtools.compat. dbus |
284 | 111 | # expects this to be str regardless of version. | 111 | # expects this to be str regardless of version. |
285 | 112 | self.bus = dbus.bus.BusConnection(address_or_type=str(bus_address), | 112 | self.bus = dbus.bus.BusConnection(address_or_type=str(bus_address), |
287 | 113 | mainloop=self.loop) | 113 | mainloop=self.loop) |
288 | 114 | 114 | ||
289 | 115 | # Monkeypatch the dbus.SessionBus/SystemBus methods, to ensure we | 115 | # Monkeypatch the dbus.SessionBus/SystemBus methods, to ensure we |
290 | 116 | # always point at our own private bus instance. | 116 | # always point at our own private bus instance. |
291 | 117 | 117 | ||
292 | === modified file 'ubuntuone/devtools/testcases/tests/test_squid_testcase.py' | |||
293 | --- ubuntuone/devtools/testcases/tests/test_squid_testcase.py 2012-04-24 17:58:16 +0000 | |||
294 | +++ ubuntuone/devtools/testcases/tests/test_squid_testcase.py 2012-11-29 21:41:22 +0000 | |||
295 | @@ -71,7 +71,7 @@ | |||
296 | 71 | """Provide useful web methods with proxy.""" | 71 | """Provide useful web methods with proxy.""" |
297 | 72 | 72 | ||
298 | 73 | def __init__(self, proxy_url=None, proxy_port=None, username=None, | 73 | def __init__(self, proxy_url=None, proxy_port=None, username=None, |
300 | 74 | password=None): | 74 | password=None): |
301 | 75 | """Create a new instance with the proxy settings.""" | 75 | """Create a new instance with the proxy settings.""" |
302 | 76 | self.proxy_url = proxy_url | 76 | self.proxy_url = proxy_url |
303 | 77 | self.proxy_port = proxy_port | 77 | self.proxy_port = proxy_port |
304 | @@ -105,8 +105,9 @@ | |||
305 | 105 | # we try to get the page using the basic auth | 105 | # we try to get the page using the basic auth |
306 | 106 | auth = base64.b64encode('%s:%s' % (self.username, self.password)) | 106 | auth = base64.b64encode('%s:%s' % (self.username, self.password)) |
307 | 107 | auth_header = 'Basic ' + auth.strip() | 107 | auth_header = 'Basic ' + auth.strip() |
310 | 108 | self.factory = ProxyClientFactory(self.proxy_url, self.proxy_port, | 108 | self.factory = ProxyClientFactory( |
311 | 109 | url, headers={'Proxy-Authorization': auth_header}) | 109 | self.proxy_url, self.proxy_port, |
312 | 110 | url, headers={'Proxy-Authorization': auth_header}) | ||
313 | 110 | self._connect(url, contextFactory) | 111 | self._connect(url, contextFactory) |
314 | 111 | return self.factory.deferred | 112 | return self.factory.deferred |
315 | 112 | else: | 113 | else: |
316 | @@ -123,7 +124,7 @@ | |||
317 | 123 | headers={'Connection': 'close'}) | 124 | headers={'Connection': 'close'}) |
318 | 124 | self._connect(url, contextFactory) | 125 | self._connect(url, contextFactory) |
319 | 125 | self.factory.deferred.addErrback(self._process_auth_error, url, | 126 | self.factory.deferred.addErrback(self._process_auth_error, url, |
321 | 126 | contextFactory) | 127 | contextFactory) |
322 | 127 | return self.factory.deferred | 128 | return self.factory.deferred |
323 | 128 | 129 | ||
324 | 129 | @defer.inlineCallbacks | 130 | @defer.inlineCallbacks |
325 | @@ -177,7 +178,8 @@ | |||
326 | 177 | root.putChild(THROWERROR, resource.NoResource()) | 178 | root.putChild(THROWERROR, resource.NoResource()) |
327 | 178 | 179 | ||
328 | 179 | unauthorized_resource = resource.ErrorPage(resource.http.UNAUTHORIZED, | 180 | unauthorized_resource = resource.ErrorPage(resource.http.UNAUTHORIZED, |
330 | 180 | "Unauthorized", "Unauthorized") | 181 | "Unauthorized", |
331 | 182 | "Unauthorized") | ||
332 | 181 | root.putChild(UNAUTHORIZED, unauthorized_resource) | 183 | root.putChild(UNAUTHORIZED, unauthorized_resource) |
333 | 182 | 184 | ||
334 | 183 | self.site = SaveSite(root) | 185 | self.site = SaveSite(root) |
335 | @@ -221,9 +223,10 @@ | |||
336 | 221 | """Clean resources.""" | 223 | """Clean resources.""" |
337 | 222 | if self.proxy_client is not None: | 224 | if self.proxy_client is not None: |
338 | 223 | self.proxy_client.shutdown() | 225 | self.proxy_client.shutdown() |
342 | 224 | return defer.gatherResults([self.ws.stop(), | 226 | return defer.gatherResults( |
343 | 225 | self.proxy_client.shutdown(), | 227 | [self.ws.stop(), |
344 | 226 | self.proxy_client.factory.disconnected_d]) | 228 | self.proxy_client.shutdown(), |
345 | 229 | self.proxy_client.factory.disconnected_d]) | ||
346 | 227 | else: | 230 | else: |
347 | 228 | return self.ws.stop() | 231 | return self.ws.stop() |
348 | 229 | 232 | ||
349 | @@ -234,8 +237,10 @@ | |||
350 | 234 | 237 | ||
351 | 235 | def access_auth_url(self, address, port, username, password): | 238 | def access_auth_url(self, address, port, username, password): |
352 | 236 | """Access a url throught the proxy.""" | 239 | """Access a url throught the proxy.""" |
355 | 237 | self.proxy_client = ProxyWebClient(proxy_url=address, proxy_port=port, | 240 | self.proxy_client = ProxyWebClient(proxy_url=address, |
356 | 238 | username=username, password=password) | 241 | proxy_port=port, |
357 | 242 | username=username, | ||
358 | 243 | password=password) | ||
359 | 239 | return self.proxy_client.get_page(self.url) | 244 | return self.proxy_client.get_page(self.url) |
360 | 240 | 245 | ||
361 | 241 | @defer.inlineCallbacks | 246 | @defer.inlineCallbacks |
362 | @@ -262,9 +267,10 @@ | |||
363 | 262 | """Test failing accessing the url.""" | 267 | """Test failing accessing the url.""" |
364 | 263 | settings = self.get_auth_proxy_settings() | 268 | settings = self.get_auth_proxy_settings() |
365 | 264 | # swap password for username to fail | 269 | # swap password for username to fail |
369 | 265 | d = self.failUnlessFailure(self.access_auth_url(settings['host'], | 270 | d = self.failUnlessFailure( |
370 | 266 | settings['port'], settings['password'], | 271 | self.access_auth_url(settings['host'], |
371 | 267 | settings['username']), error.Error) | 272 | settings['port'], settings['password'], |
372 | 273 | settings['username']), error.Error) | ||
373 | 268 | return d | 274 | return d |
374 | 269 | 275 | ||
375 | 270 | def test_auth_url_407(self): | 276 | def test_auth_url_407(self): |
376 | 271 | 277 | ||
377 | === modified file 'ubuntuone/devtools/testcases/tests/test_txsocketserver.py' | |||
378 | --- ubuntuone/devtools/testcases/tests/test_txsocketserver.py 2012-06-08 11:55:53 +0000 | |||
379 | +++ ubuntuone/devtools/testcases/tests/test_txsocketserver.py 2012-11-29 21:41:22 +0000 | |||
380 | @@ -139,9 +139,9 @@ | |||
381 | 139 | prot.factory._disconnecting = disconnecting | 139 | prot.factory._disconnecting = disconnecting |
382 | 140 | prot.connectionLost() | 140 | prot.connectionLost() |
383 | 141 | self.assertIn('connectionLost', self.called, | 141 | self.assertIn('connectionLost', self.called, |
385 | 142 | 'Super connectionLost most be called') | 142 | 'Super connectionLost most be called') |
386 | 143 | self.assertEqual(disconnecting, | 143 | self.assertEqual(disconnecting, |
388 | 144 | prot.factory.testserver_on_connection_lost.called) | 144 | prot.factory.testserver_on_connection_lost.called) |
389 | 145 | 145 | ||
390 | 146 | def test_connection_lost_disconnecting(self): | 146 | def test_connection_lost_disconnecting(self): |
391 | 147 | """Test the connectionLost method.""" | 147 | """Test the connectionLost method.""" |
392 | @@ -163,7 +163,7 @@ | |||
393 | 163 | prot.factory.testserver_on_connection_lost.callback(True) | 163 | prot.factory.testserver_on_connection_lost.callback(True) |
394 | 164 | prot.connectionLost() | 164 | prot.connectionLost() |
395 | 165 | self.assertIn('connectionLost', self.called, | 165 | self.assertIn('connectionLost', self.called, |
397 | 166 | 'Super connectionLost must be called') | 166 | 'Super connectionLost must be called') |
398 | 167 | # pylint: enable=E1102 | 167 | # pylint: enable=E1102 |
399 | 168 | 168 | ||
400 | 169 | 169 | ||
401 | @@ -187,7 +187,7 @@ | |||
402 | 187 | protocol_instance = protocol_cls() | 187 | protocol_instance = protocol_cls() |
403 | 188 | protocol_instance.connectionMade() | 188 | protocol_instance.connectionMade() |
404 | 189 | self.assertIn('connectionMade', self.called, | 189 | self.assertIn('connectionMade', self.called, |
406 | 190 | 'Super connectionMade must be called') | 190 | 'Super connectionMade must be called') |
407 | 191 | 191 | ||
408 | 192 | # factory outside init | 192 | # factory outside init |
409 | 193 | def test_connection_made_called(self): | 193 | def test_connection_made_called(self): |
410 | @@ -203,7 +203,7 @@ | |||
411 | 203 | protocol_instance.factory.testserver_on_connection_made.callback(True) | 203 | protocol_instance.factory.testserver_on_connection_made.callback(True) |
412 | 204 | protocol_instance.connectionMade() | 204 | protocol_instance.connectionMade() |
413 | 205 | self.assertIn('connectionMade', self.called, | 205 | self.assertIn('connectionMade', self.called, |
415 | 206 | 'Super connectionMade must be called') | 206 | 'Super connectionMade must be called') |
416 | 207 | # pylint: enable=E1101 | 207 | # pylint: enable=E1101 |
417 | 208 | 208 | ||
418 | 209 | 209 | ||
419 | @@ -283,8 +283,8 @@ | |||
420 | 283 | calculator = yield self.client_factory.getRootObject() | 283 | calculator = yield self.client_factory.getRootObject() |
421 | 284 | adder = yield calculator.callRemote('get_adder') | 284 | adder = yield calculator.callRemote('get_adder') |
422 | 285 | self.setup_result = yield adder.callRemote('add', | 285 | self.setup_result = yield adder.callRemote('add', |
425 | 286 | self.first_number, | 286 | self.first_number, |
426 | 287 | self.second_number) | 287 | self.second_number) |
427 | 288 | 288 | ||
428 | 289 | def test_deferreds(self): | 289 | def test_deferreds(self): |
429 | 290 | """Test that the deferreds are not broken.""" | 290 | """Test that the deferreds are not broken.""" |
430 | @@ -391,10 +391,10 @@ | |||
431 | 391 | first_number = 1 | 391 | first_number = 1 |
432 | 392 | second_number = 2 | 392 | second_number = 2 |
433 | 393 | yield self.first_tcp_server.listen_server(pb.PBServerFactory, | 393 | yield self.first_tcp_server.listen_server(pb.PBServerFactory, |
435 | 394 | self.calculator) | 394 | self.calculator) |
436 | 395 | self.addCleanup(self.first_tcp_server.clean_up) | 395 | self.addCleanup(self.first_tcp_server.clean_up) |
437 | 396 | calculator_c = yield self.first_tcp_server.connect_client( | 396 | calculator_c = yield self.first_tcp_server.connect_client( |
439 | 397 | pb.PBClientFactory) | 397 | pb.PBClientFactory) |
440 | 398 | calculator = yield calculator_c.getRootObject() | 398 | calculator = yield calculator_c.getRootObject() |
441 | 399 | adder = yield calculator.callRemote('get_adder') | 399 | adder = yield calculator.callRemote('get_adder') |
442 | 400 | result = yield adder.callRemote('add', first_number, second_number) | 400 | result = yield adder.callRemote('add', first_number, second_number) |
443 | @@ -407,7 +407,7 @@ | |||
444 | 407 | second_number = 2 | 407 | second_number = 2 |
445 | 408 | # first server | 408 | # first server |
446 | 409 | yield self.first_tcp_server.listen_server(pb.PBServerFactory, | 409 | yield self.first_tcp_server.listen_server(pb.PBServerFactory, |
448 | 410 | self.calculator) | 410 | self.calculator) |
449 | 411 | self.addCleanup(self.first_tcp_server.clean_up) | 411 | self.addCleanup(self.first_tcp_server.clean_up) |
450 | 412 | 412 | ||
451 | 413 | # second server | 413 | # second server |
452 | @@ -417,9 +417,9 @@ | |||
453 | 417 | 417 | ||
454 | 418 | # connect the diff clients | 418 | # connect the diff clients |
455 | 419 | calculator_c = yield self.first_tcp_server.connect_client( | 419 | calculator_c = yield self.first_tcp_server.connect_client( |
457 | 420 | pb.PBClientFactory) | 420 | pb.PBClientFactory) |
458 | 421 | echoer_c = yield self.second_tcp_server.connect_client( | 421 | echoer_c = yield self.second_tcp_server.connect_client( |
460 | 422 | pb.PBClientFactory) | 422 | pb.PBClientFactory) |
461 | 423 | 423 | ||
462 | 424 | calculator = yield calculator_c.getRootObject() | 424 | calculator = yield calculator_c.getRootObject() |
463 | 425 | adder = yield calculator.callRemote('get_adder') | 425 | adder = yield calculator.callRemote('get_adder') |
464 | @@ -434,7 +434,7 @@ | |||
465 | 434 | """Test setting a single server no client.""" | 434 | """Test setting a single server no client.""" |
466 | 435 | # start server but do not connect a client | 435 | # start server but do not connect a client |
467 | 436 | yield self.first_tcp_server.listen_server(pb.PBServerFactory, | 436 | yield self.first_tcp_server.listen_server(pb.PBServerFactory, |
469 | 437 | self.calculator) | 437 | self.calculator) |
470 | 438 | self.addCleanup(self.first_tcp_server.clean_up) | 438 | self.addCleanup(self.first_tcp_server.clean_up) |
471 | 439 | 439 | ||
472 | 440 | @defer.inlineCallbacks | 440 | @defer.inlineCallbacks |
473 | @@ -442,7 +442,7 @@ | |||
474 | 442 | """Test setting multiple servers no clients.""" | 442 | """Test setting multiple servers no clients.""" |
475 | 443 | # first server | 443 | # first server |
476 | 444 | yield self.first_tcp_server.listen_server(pb.PBServerFactory, | 444 | yield self.first_tcp_server.listen_server(pb.PBServerFactory, |
478 | 445 | self.calculator) | 445 | self.calculator) |
479 | 446 | self.addCleanup(self.first_tcp_server.clean_up) | 446 | self.addCleanup(self.first_tcp_server.clean_up) |
480 | 447 | 447 | ||
481 | 448 | # second server | 448 | # second server |
482 | 449 | 449 | ||
483 | === modified file 'ubuntuone/devtools/testcases/txsocketserver.py' | |||
484 | --- ubuntuone/devtools/testcases/txsocketserver.py 2012-06-08 14:16:29 +0000 | |||
485 | +++ ubuntuone/devtools/testcases/txsocketserver.py 2012-11-29 21:41:22 +0000 | |||
486 | @@ -143,7 +143,7 @@ | |||
487 | 143 | self.server_factory = tidy_class(*args, **kwargs) | 143 | self.server_factory = tidy_class(*args, **kwargs) |
488 | 144 | self.server_factory._disconnecting = False | 144 | self.server_factory._disconnecting = False |
489 | 145 | self.server_factory.protocol = server_protocol_factory( | 145 | self.server_factory.protocol = server_protocol_factory( |
491 | 146 | self.server_factory.protocol) | 146 | self.server_factory.protocol) |
492 | 147 | endpoint = endpoints.serverFromString(reactor, | 147 | endpoint = endpoints.serverFromString(reactor, |
493 | 148 | self.get_server_endpoint()) | 148 | self.get_server_endpoint()) |
494 | 149 | self.listener = yield endpoint.listen(self.server_factory) | 149 | self.listener = yield endpoint.listen(self.server_factory) |
495 | @@ -163,10 +163,10 @@ | |||
496 | 163 | self.client_factory = client_class(*args, **kwargs) | 163 | self.client_factory = client_class(*args, **kwargs) |
497 | 164 | self.client_factory._disconnecting = False | 164 | self.client_factory._disconnecting = False |
498 | 165 | self.client_factory.protocol = client_protocol_factory( | 165 | self.client_factory.protocol = client_protocol_factory( |
500 | 166 | self.client_factory.protocol) | 166 | self.client_factory.protocol) |
501 | 167 | self.client_factory.testserver_on_connection_lost = defer.Deferred() | 167 | self.client_factory.testserver_on_connection_lost = defer.Deferred() |
502 | 168 | endpoint = endpoints.clientFromString(reactor, | 168 | endpoint = endpoints.clientFromString(reactor, |
504 | 169 | self.get_client_endpoint()) | 169 | self.get_client_endpoint()) |
505 | 170 | self.connector = yield endpoint.connect(self.client_factory) | 170 | self.connector = yield endpoint.connect(self.client_factory) |
506 | 171 | defer.returnValue(self.client_factory) | 171 | defer.returnValue(self.client_factory) |
507 | 172 | 172 | ||
508 | @@ -183,12 +183,14 @@ | |||
509 | 183 | d = defer.maybeDeferred(self.listener.stopListening) | 183 | d = defer.maybeDeferred(self.listener.stopListening) |
510 | 184 | self.connector.transport.loseConnection() | 184 | self.connector.transport.loseConnection() |
511 | 185 | if self.server_factory.testserver_on_connection_lost: | 185 | if self.server_factory.testserver_on_connection_lost: |
515 | 186 | return defer.gatherResults([d, | 186 | return defer.gatherResults( |
516 | 187 | self.client_factory.testserver_on_connection_lost, | 187 | [d, |
517 | 188 | self.server_factory.testserver_on_connection_lost]) | 188 | self.client_factory.testserver_on_connection_lost, |
518 | 189 | self.server_factory.testserver_on_connection_lost]) | ||
519 | 189 | else: | 190 | else: |
522 | 190 | return defer.gatherResults([d, | 191 | return defer.gatherResults( |
523 | 191 | self.client_factory.testserver_on_connection_lost]) | 192 | [d, |
524 | 193 | self.client_factory.testserver_on_connection_lost]) | ||
525 | 192 | if self.listener: | 194 | if self.listener: |
526 | 193 | # just clean the server since there is no client | 195 | # just clean the server since there is no client |
527 | 194 | # pylint: disable=W0201 | 196 | # pylint: disable=W0201 |
528 | @@ -213,7 +215,7 @@ | |||
529 | 213 | raise ValueError('Server Factory was not provided.') | 215 | raise ValueError('Server Factory was not provided.') |
530 | 214 | if self.listener is None: | 216 | if self.listener is None: |
531 | 215 | raise ValueError('%s has not started listening.', | 217 | raise ValueError('%s has not started listening.', |
533 | 216 | self.server_factory) | 218 | self.server_factory) |
534 | 217 | return self.client_endpoint_pattern % self.listener.getHost().port | 219 | return self.client_endpoint_pattern % self.listener.getHost().port |
535 | 218 | 220 | ||
536 | 219 | 221 | ||
537 | @@ -279,9 +281,9 @@ | |||
538 | 279 | passed to the server constructor. | 281 | passed to the server constructor. |
539 | 280 | """ | 282 | """ |
540 | 281 | self.server_factory = yield self.server_runner.listen_server( | 283 | self.server_factory = yield self.server_runner.listen_server( |
542 | 282 | server_class, *args, **kwargs) | 284 | server_class, *args, **kwargs) |
543 | 283 | self.server_disconnected = \ | 285 | self.server_disconnected = \ |
545 | 284 | self.server_factory.testserver_on_connection_lost | 286 | self.server_factory.testserver_on_connection_lost |
546 | 285 | self.listener = self.server_runner.listener | 287 | self.listener = self.server_runner.listener |
547 | 286 | 288 | ||
548 | 287 | @defer.inlineCallbacks | 289 | @defer.inlineCallbacks |
549 | @@ -292,9 +294,9 @@ | |||
550 | 292 | should be passed to the client constructor. | 294 | should be passed to the client constructor. |
551 | 293 | """ | 295 | """ |
552 | 294 | self.client_factory = yield self.server_runner.connect_client( | 296 | self.client_factory = yield self.server_runner.connect_client( |
554 | 295 | client_class, *args, **kwargs) | 297 | client_class, *args, **kwargs) |
555 | 296 | self.client_disconnected = \ | 298 | self.client_disconnected = \ |
557 | 297 | self.client_factory.testserver_on_connection_lost | 299 | self.client_factory.testserver_on_connection_lost |
558 | 298 | self.connector = self.server_runner.connector | 300 | self.connector = self.server_runner.connector |
559 | 299 | 301 | ||
560 | 300 | def tear_down_server_client(self): | 302 | def tear_down_server_client(self): |
561 | @@ -330,13 +332,13 @@ | |||
562 | 330 | def listen_server(self, *args, **kwargs): | 332 | def listen_server(self, *args, **kwargs): |
563 | 331 | """Listen a pb server.""" | 333 | """Listen a pb server.""" |
564 | 332 | yield super(PbServerTestCase, self).listen_server(pb.PBServerFactory, | 334 | yield super(PbServerTestCase, self).listen_server(pb.PBServerFactory, |
566 | 333 | *args, **kwargs) | 335 | *args, **kwargs) |
567 | 334 | 336 | ||
568 | 335 | @defer.inlineCallbacks | 337 | @defer.inlineCallbacks |
569 | 336 | def connect_client(self, *args, **kwargs): | 338 | def connect_client(self, *args, **kwargs): |
570 | 337 | """Connect a pb client.""" | 339 | """Connect a pb client.""" |
571 | 338 | yield super(PbServerTestCase, self).connect_client(pb.PBClientFactory, | 340 | yield super(PbServerTestCase, self).connect_client(pb.PBClientFactory, |
573 | 339 | *args, **kwargs) | 341 | *args, **kwargs) |
574 | 340 | 342 | ||
575 | 341 | 343 | ||
576 | 342 | class TCPPbServerTestCase(PbServerTestCase): | 344 | class TCPPbServerTestCase(PbServerTestCase): |
577 | 343 | 345 | ||
578 | === modified file 'ubuntuone/devtools/testing/tests/test_txwebserver.py' | |||
579 | --- ubuntuone/devtools/testing/tests/test_txwebserver.py 2012-08-28 20:28:43 +0000 | |||
580 | +++ ubuntuone/devtools/testing/tests/test_txwebserver.py 2012-11-29 21:41:22 +0000 | |||
581 | @@ -40,7 +40,7 @@ | |||
582 | 40 | SAMPLE_KEY = b"result" | 40 | SAMPLE_KEY = b"result" |
583 | 41 | SAMPLE_VALUE = b"sample result" | 41 | SAMPLE_VALUE = b"sample result" |
584 | 42 | SAMPLE_RESOURCE = '{{"{0}": "{1}"}}'.format( | 42 | SAMPLE_RESOURCE = '{{"{0}": "{1}"}}'.format( |
586 | 43 | SAMPLE_KEY, SAMPLE_VALUE).encode("utf8") | 43 | SAMPLE_KEY, SAMPLE_VALUE).encode("utf8") |
587 | 44 | SIMPLERESOURCE = b"simpleresource" | 44 | SIMPLERESOURCE = b"simpleresource" |
588 | 45 | OTHER_SIMPLERESOURCE = b"othersimpleresource" | 45 | OTHER_SIMPLERESOURCE = b"othersimpleresource" |
589 | 46 | THROWERROR = b"throwerror" | 46 | THROWERROR = b"throwerror" |
590 | @@ -74,12 +74,13 @@ | |||
591 | 74 | root.putChild(THROWERROR, resource.NoResource()) | 74 | root.putChild(THROWERROR, resource.NoResource()) |
592 | 75 | 75 | ||
593 | 76 | unauthorized_resource = resource.ErrorPage(resource.http.UNAUTHORIZED, | 76 | unauthorized_resource = resource.ErrorPage(resource.http.UNAUTHORIZED, |
595 | 77 | "Unauthorized", "Unauthorized") | 77 | "Unauthorized", |
596 | 78 | "Unauthorized") | ||
597 | 78 | root.putChild(UNAUTHORIZED, unauthorized_resource) | 79 | root.putChild(UNAUTHORIZED, unauthorized_resource) |
598 | 79 | self.server = HTTPWebServer(root) | 80 | self.server = HTTPWebServer(root) |
599 | 80 | self.server.start() | 81 | self.server.start() |
600 | 81 | self.uri = "http://127.0.0.1:{port}/".format( | 82 | self.uri = "http://127.0.0.1:{port}/".format( |
602 | 82 | port=self.server.get_port()).encode("utf8") | 83 | port=self.server.get_port()).encode("utf8") |
603 | 83 | self.addCleanup(self.server.stop) | 84 | self.addCleanup(self.server.stop) |
604 | 84 | 85 | ||
605 | 85 | @defer.inlineCallbacks | 86 | @defer.inlineCallbacks |
606 | @@ -130,7 +131,8 @@ | |||
607 | 130 | self.root.putChild(THROWERROR, resource.NoResource()) | 131 | self.root.putChild(THROWERROR, resource.NoResource()) |
608 | 131 | 132 | ||
609 | 132 | unauthorized_resource = resource.ErrorPage(resource.http.UNAUTHORIZED, | 133 | unauthorized_resource = resource.ErrorPage(resource.http.UNAUTHORIZED, |
611 | 133 | "Unauthorized", "Unauthorized") | 134 | "Unauthorized", |
612 | 135 | "Unauthorized") | ||
613 | 134 | self.root.putChild(UNAUTHORIZED, unauthorized_resource) | 136 | self.root.putChild(UNAUTHORIZED, unauthorized_resource) |
614 | 135 | 137 | ||
615 | 136 | def get_uri(self, server): | 138 | def get_uri(self, server): |
616 | 137 | 139 | ||
617 | === modified file 'ubuntuone/devtools/testing/txcheck.py' | |||
618 | --- ubuntuone/devtools/testing/txcheck.py 2012-08-20 22:39:50 +0000 | |||
619 | +++ ubuntuone/devtools/testing/txcheck.py 2012-11-29 21:41:22 +0000 | |||
620 | @@ -303,17 +303,17 @@ | |||
621 | 303 | if not any_matches(decorators, INLINE_CALLBACKS_DECORATOR): | 303 | if not any_matches(decorators, INLINE_CALLBACKS_DECORATOR): |
622 | 304 | # ...but the inlineCallbacks decorator is missing | 304 | # ...but the inlineCallbacks decorator is missing |
623 | 305 | problem = MissingInlineCallbacks( | 305 | problem = MissingInlineCallbacks( |
627 | 306 | method=def_node.name, | 306 | method=def_node.name, |
628 | 307 | test_class=class_to_check, | 307 | test_class=class_to_check, |
629 | 308 | ancestor_class=ancestor_class) | 308 | ancestor_class=ancestor_class) |
630 | 309 | problems.add(problem) | 309 | problems.add(problem) |
631 | 310 | else: | 310 | else: |
632 | 311 | if not matches(def_node, match_descendant(RETURN_VALUE, DEFS)): | 311 | if not matches(def_node, match_descendant(RETURN_VALUE, DEFS)): |
633 | 312 | # The function fails to return a deferred | 312 | # The function fails to return a deferred |
634 | 313 | problem = MissingReturnValue( | 313 | problem = MissingReturnValue( |
638 | 314 | method=def_node.name, | 314 | method=def_node.name, |
639 | 315 | test_class=class_to_check, | 315 | test_class=class_to_check, |
640 | 316 | ancestor_class=ancestor_class) | 316 | ancestor_class=ancestor_class) |
641 | 317 | problems.add(problem) | 317 | problems.add(problem) |
642 | 318 | 318 | ||
643 | 319 | return problems | 319 | return problems |
644 | 320 | 320 | ||
645 | === modified file 'ubuntuone/devtools/testing/txwebserver.py' | |||
646 | --- ubuntuone/devtools/testing/txwebserver.py 2012-08-21 21:36:20 +0000 | |||
647 | +++ ubuntuone/devtools/testing/txwebserver.py 2012-11-29 21:41:22 +0000 | |||
648 | @@ -68,7 +68,7 @@ | |||
649 | 68 | def get_iri(self): | 68 | def get_iri(self): |
650 | 69 | """Build the iri for this mock server.""" | 69 | """Build the iri for this mock server.""" |
651 | 70 | return "{scheme}://127.0.0.1:{port}/".format(scheme=self.scheme, | 70 | return "{scheme}://127.0.0.1:{port}/".format(scheme=self.scheme, |
653 | 71 | port=self.get_port()) | 71 | port=self.get_port()) |
654 | 72 | 72 | ||
655 | 73 | def get_port(self): | 73 | def get_port(self): |
656 | 74 | """Return the port where we are listening.""" | 74 | """Return the port where we are listening.""" |
657 | @@ -88,10 +88,11 @@ | |||
658 | 88 | con.transport.loseConnection() | 88 | con.transport.loseConnection() |
659 | 89 | else: | 89 | else: |
660 | 90 | self.wrapper.testserver_on_connection_lost = \ | 90 | self.wrapper.testserver_on_connection_lost = \ |
662 | 91 | defer.succeed(None) | 91 | defer.succeed(None) |
663 | 92 | d = defer.maybeDeferred(self.port.stopListening) | 92 | d = defer.maybeDeferred(self.port.stopListening) |
666 | 93 | return defer.gatherResults([d, | 93 | return defer.gatherResults( |
667 | 94 | self.wrapper.testserver_on_connection_lost]) | 94 | [d, |
668 | 95 | self.wrapper.testserver_on_connection_lost]) | ||
669 | 95 | return defer.succeed(None) | 96 | return defer.succeed(None) |
670 | 96 | 97 | ||
671 | 97 | 98 | ||
672 | @@ -118,6 +119,6 @@ | |||
673 | 118 | def listen(self, site): | 119 | def listen(self, site): |
674 | 119 | """Listen a port to allow the tests.""" | 120 | """Listen a port to allow the tests.""" |
675 | 120 | ssl_context = ssl.DefaultOpenSSLContextFactory( | 121 | ssl_context = ssl.DefaultOpenSSLContextFactory( |
677 | 121 | self.ssl_settings['key'], self.ssl_settings['cert']) | 122 | self.ssl_settings['key'], self.ssl_settings['cert']) |
678 | 122 | 123 | ||
679 | 123 | return reactor.listenSSL(0, site, ssl_context) | 124 | return reactor.listenSSL(0, site, ssl_context) |
680 | 124 | 125 | ||
681 | === modified file 'ubuntuone/devtools/tests/test_decorators.py' | |||
682 | --- ubuntuone/devtools/tests/test_decorators.py 2012-10-18 21:17:22 +0000 | |||
683 | +++ ubuntuone/devtools/tests/test_decorators.py 2012-11-29 21:41:22 +0000 | |||
684 | @@ -90,7 +90,7 @@ | |||
685 | 90 | self.assertEqual(len(result.skips), 1) | 90 | self.assertEqual(len(result.skips), 1) |
686 | 91 | self.assertEqual(result.successes, 1) | 91 | self.assertEqual(result.successes, 1) |
687 | 92 | self.assertEqual(result.skips, | 92 | self.assertEqual(result.skips, |
689 | 93 | [(test_do_skip, do_skip[1])]) | 93 | [(test_do_skip, do_skip[1])]) |
690 | 94 | 94 | ||
691 | 95 | def test_skip_class(self): | 95 | def test_skip_class(self): |
692 | 96 | """Test skipping a full test class.""" | 96 | """Test skipping a full test class.""" |
693 | 97 | 97 | ||
694 | === modified file 'ubuntuone/devtools/tests/test_txcheck.py' | |||
695 | --- ubuntuone/devtools/tests/test_txcheck.py 2012-03-30 17:44:03 +0000 | |||
696 | +++ ubuntuone/devtools/tests/test_txcheck.py 2012-11-29 21:41:22 +0000 | |||
697 | @@ -110,7 +110,7 @@ | |||
698 | 110 | problems = find_problems(MissingReturnCase) | 110 | problems = find_problems(MissingReturnCase) |
699 | 111 | self.assertEqual(problems, set([ | 111 | self.assertEqual(problems, set([ |
700 | 112 | MissingReturnValue(method=m, test_class=MissingReturnCase, | 112 | MissingReturnValue(method=m, test_class=MissingReturnCase, |
702 | 113 | ancestor_class=MissingReturnCase) | 113 | ancestor_class=MissingReturnCase) |
703 | 114 | for m in ('setUp', 'tearDown')])) | 114 | for m in ('setUp', 'tearDown')])) |
704 | 115 | 115 | ||
705 | 116 | def test_super_not_called(self): | 116 | def test_super_not_called(self): |
706 | @@ -130,7 +130,7 @@ | |||
707 | 130 | problems = find_problems(NoSuperCase) | 130 | problems = find_problems(NoSuperCase) |
708 | 131 | self.assertEqual(problems, set([ | 131 | self.assertEqual(problems, set([ |
709 | 132 | SuperNotCalled(method=m, test_class=NoSuperCase, | 132 | SuperNotCalled(method=m, test_class=NoSuperCase, |
711 | 133 | ancestor_class=NoSuperCase) | 133 | ancestor_class=NoSuperCase) |
712 | 134 | for m in ('setUp', 'tearDown')])) | 134 | for m in ('setUp', 'tearDown')])) |
713 | 135 | 135 | ||
714 | 136 | def test_bare_super(self): | 136 | def test_bare_super(self): |
715 | @@ -152,7 +152,7 @@ | |||
716 | 152 | problems = find_problems(BareSuperCase) | 152 | problems = find_problems(BareSuperCase) |
717 | 153 | self.assertEqual(problems, set([ | 153 | self.assertEqual(problems, set([ |
718 | 154 | SuperResultDiscarded(method=m, test_class=BareSuperCase, | 154 | SuperResultDiscarded(method=m, test_class=BareSuperCase, |
720 | 155 | ancestor_class=BareSuperCase) | 155 | ancestor_class=BareSuperCase) |
721 | 156 | for m in ('setUp', 'tearDown')])) | 156 | for m in ('setUp', 'tearDown')])) |
722 | 157 | 157 | ||
723 | 158 | def test_inline_callbacks_missing(self): | 158 | def test_inline_callbacks_missing(self): |
The attempt to merge lp:~dobey/ubuntuone-dev-tools/update-4-2 into lp:ubuntuone-dev-tools/stable-4-2 failed. Below is the output from the failed tests.
Starting squid version... devtools. testing. tests.test_ txwebserver rversTestCase multiple_ requests ... [OK] single_ request ... [OK] trial.unittest devtools. testing. tests.test_ txwebserver multiple_ requests ... [OK] single_ request ... [OK] devtools. testcases devtools. tests.test_ decorators Decorators skip_decorators ... [OK] devtools. tests.test_ txcheck tedTestClass bad_mixin_ order ... [OK] inline_ callbacks ... [OK] inline_ callbacks_ missing ... [OK] missing_ return ... [OK] no_problems ... [OK] not_twisted ... [OK] ok_mixin_ order ... [OK] super_not_ called ... [OK] eckSuite suite_catches_ problems ... [OK] suite_runs_ tests ... [OK] trial.unittest devtools. testcases devtools. tests.test_ utils estCase get_flags_ long_arg ... [OK] get_flags_ short_arg ... [OK] get_params_ combined_ arg ... [OK] get_params_ missing_ arg ... [OK] get_params_ short_arg ... [OK] get_params_ split_arg ... [OK] unknown_ option ... [OK] devtools. testcases. tests.te. ..
Waiting for squid to start....
Waiting for squid to start.....
ubuntuone.
MultipleWebSe
test_
test_
twisted.
TestCase
runTest ... [OK]
ubuntuone.
WebServerTestCase
test_get_iri ... [OK]
test_get_port ... [OK]
test_
test_
ubuntuone.
BaseTestCase
runTest ... [OK]
ubuntuone.
TestSkipBasic
test_skip_class ... [OK]
test_
ubuntuone.
TestCheckTwis
test_
test_bare_super ... [OK]
test_
test_
test_
test_
test_
test_
test_
TestTwistedCh
test_
test_
twisted.
TestCase
runTest ... [OK]
ubuntuone.
BaseTestCase
runTest ... [OK]
ubuntuone.
OptionParserT
test_
test_
test_
test_
test_
test_
test_
ubuntuone.