Merge lp:~dobey/ubuntuone-dev-tools/update-4-2 into lp:ubuntuone-dev-tools/stable-4-2

Proposed by dobey on 2012-11-29
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
Reviewer Review Type Date Requested Status
Roberto Alsina (community) 2012-11-29 Approve on 2012-11-30
Review via email: mp+137057@code.launchpad.net

Commit message

Fix pep8 warnings that are newly presented in pep8 1.3

To post a comment you must log in.
Roberto Alsina (ralsina) :
review: Approve
Ubuntu One Auto Pilot (otto-pilot) wrote :
Download full text (24.8 KiB)

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...
Waiting for squid to start....
Waiting for squid to start.....
ubuntuone.devtools.testing.tests.test_txwebserver
  MultipleWebServersTestCase
    test_multiple_requests ... [OK]
    test_single_request ... [OK]
twisted.trial.unittest
  TestCase
    runTest ... [OK]
ubuntuone.devtools.testing.tests.test_txwebserver
  WebServerTestCase
    test_get_iri ... [OK]
    test_get_port ... [OK]
    test_multiple_requests ... [OK]
    test_single_request ... [OK]
ubuntuone.devtools.testcases
  BaseTestCase
    runTest ... [OK]
ubuntuone.devtools.tests.test_decorators
  TestSkipBasicDecorators
    test_skip_class ... [OK]
    test_skip_decorators ... [OK]
ubuntuone.devtools.tests.test_txcheck
  TestCheckTwistedTestClass
    test_bad_mixin_order ... [OK]
    test_bare_super ... [OK]
    test_inline_callbacks ... [OK]
    test_inline_callbacks_missing ... [OK]
    test_missing_return ... [OK]
    test_no_problems ... [OK]
    test_not_twisted ... [OK]
    test_ok_mixin_order ... [OK]
    test_super_not_called ... [OK]
  TestTwistedCheckSuite
    test_suite_catches_problems ... [OK]
    test_suite_runs_tests ... [OK]
twisted.trial.unittest
  TestCase
    runTest ... [OK]
ubuntuone.devtools.testcases
  BaseTestCase
    runTest ... [OK]
ubuntuone.devtools.tests.test_utils
  OptionParserTestCase
    test_get_flags_long_arg ... [OK]
    test_get_flags_short_arg ... [OK]
    test_get_params_combined_arg ... [OK]
    test_get_params_missing_arg ... [OK]
    test_get_params_short_arg ... [OK]
    test_get_params_split_arg ... [OK]
    test_unknown_option ... [OK]
ubuntuone.devtools.testcases.tests.te...

99. By dobey on 2012-12-10

Fix pep8 warnings that are newly presented in pep8 1.3

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

Subscribers

People subscribed via source and target branches

to all changes: