Merge lp:~dobey/ubuntuone-dev-tools/fix-1119486 into lp:ubuntuone-dev-tools

Proposed by dobey
Status: Merged
Approved by: dobey
Approved revision: 103
Merged at revision: 102
Proposed branch: lp:~dobey/ubuntuone-dev-tools/fix-1119486
Merge into: lp:ubuntuone-dev-tools
Diff against target: 112 lines (+20/-9)
3 files modified
ubuntuone/devtools/services/squid.py (+10/-2)
ubuntuone/devtools/testcases/tests/test_squid_testcase.py (+5/-3)
ubuntuone/devtools/testing/tests/test_txwebserver.py (+5/-4)
To merge this branch: bzr merge lp:~dobey/ubuntuone-dev-tools/fix-1119486
Reviewer Review Type Date Requested Status
Mike McCracken (community) Approve
Alejandro J. Cura (community) Approve
Review via email: mp+147444@code.launchpad.net

Commit message

Ignore ESRCH when killing squid process, in event it already died.
Skip a failing test on linux due to ncsa_auth crashing.
Fix dependency on re-export of imports from a twisted module.

To post a comment you must log in.
102. By dobey

Ignore ESRCH when killing squid process, in event it already died.
Skip a failing test on linux due to ncsa_auth crashing.
Fix dependency on re-export of imports from a twisted module.

Revision history for this message
Alejandro J. Cura (alecu) wrote :

+1

review: Approve
Revision history for this message
Mike McCracken (mikemc) :
review: Approve
103. By dobey

Update copyright headers too.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntuone/devtools/services/squid.py'
2--- ubuntuone/devtools/services/squid.py 2012-11-28 21:45:47 +0000
3+++ ubuntuone/devtools/services/squid.py 2013-02-08 19:40:25 +0000
4@@ -1,5 +1,5 @@
5 #
6-# Copyright 2011-2012 Canonical Ltd.
7+# Copyright 2011-2013 Canonical Ltd.
8 #
9 # This program is free software: you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License version 3, as published
11@@ -29,6 +29,7 @@
12
13 from __future__ import print_function
14
15+import errno
16 import random
17 import signal
18 # pylint:disable=W0402
19@@ -305,7 +306,14 @@
20
21 def stop_service(self):
22 """Stop our proxy,"""
23- kill_squid(self.squid_pid)
24+ try:
25+ kill_squid(self.squid_pid)
26+ except OSError as err:
27+ # If the process already died, ignore the error
28+ if err.errno == errno.ESRCH:
29+ pass
30+ else:
31+ raise
32 delete_proxy_settings()
33 self.running = False
34 unlink(self.config_file)
35
36=== modified file 'ubuntuone/devtools/testcases/tests/test_squid_testcase.py'
37--- ubuntuone/devtools/testcases/tests/test_squid_testcase.py 2012-11-28 21:45:47 +0000
38+++ ubuntuone/devtools/testcases/tests/test_squid_testcase.py 2013-02-08 19:40:25 +0000
39@@ -1,6 +1,6 @@
40 # -*- coding: utf-8 -*-
41 #
42-# Copyright 2011-2012 Canonical Ltd.
43+# Copyright 2011-2013 Canonical Ltd.
44 #
45 # This program is free software: you can redistribute it and/or modify it
46 # under the terms of the GNU General Public License version 3, as published
47@@ -32,7 +32,7 @@
48 from twisted.application import internet, service
49 from twisted.internet import defer, reactor
50 from twisted.web import client, error, http, resource, server
51-
52+from ubuntuone.devtools.testcases import skipIfOS
53 from ubuntuone.devtools.testcases.squid import SquidTestCase
54
55
56@@ -177,7 +177,7 @@
57
58 root.putChild(THROWERROR, resource.NoResource())
59
60- unauthorized_resource = resource.ErrorPage(resource.http.UNAUTHORIZED,
61+ unauthorized_resource = resource.ErrorPage(http.UNAUTHORIZED,
62 "Unauthorized",
63 "Unauthorized")
64 root.putChild(UNAUTHORIZED, unauthorized_resource)
65@@ -252,6 +252,8 @@
66 settings['port'])
67 self.assertEqual(SAMPLE_RESOURCE, data)
68
69+ @skipIfOS('linux2',
70+ 'LP: #1111880 - ncsa_auth crashing for auth proxy tests.')
71 @defer.inlineCallbacks
72 def test_auth_url_access(self):
73 """Test accessing to the url."""
74
75=== modified file 'ubuntuone/devtools/testing/tests/test_txwebserver.py'
76--- ubuntuone/devtools/testing/tests/test_txwebserver.py 2012-11-28 21:45:47 +0000
77+++ ubuntuone/devtools/testing/tests/test_txwebserver.py 2013-02-08 19:40:25 +0000
78@@ -1,5 +1,6 @@
79 # -*- coding: utf-8 -*-
80-# Copyright 2012 Canonical Ltd.
81+#
82+# Copyright 2012-2013 Canonical Ltd.
83 #
84 # This program is free software: you can redistribute it and/or modify it
85 # under the terms of the GNU General Public License version 3, as published
86@@ -32,7 +33,7 @@
87
88 from twisted.internet import defer
89 from twisted.trial.unittest import TestCase
90-from twisted.web import client, resource
91+from twisted.web import client, resource, http
92
93 from ubuntuone.devtools.testing.txwebserver import HTTPWebServer
94
95@@ -73,7 +74,7 @@
96 root.putChild(OTHER_SIMPLERESOURCE, SimpleResource())
97 root.putChild(THROWERROR, resource.NoResource())
98
99- unauthorized_resource = resource.ErrorPage(resource.http.UNAUTHORIZED,
100+ unauthorized_resource = resource.ErrorPage(http.UNAUTHORIZED,
101 "Unauthorized",
102 "Unauthorized")
103 root.putChild(UNAUTHORIZED, unauthorized_resource)
104@@ -130,7 +131,7 @@
105 self.root.putChild(OTHER_SIMPLERESOURCE, SimpleResource())
106 self.root.putChild(THROWERROR, resource.NoResource())
107
108- unauthorized_resource = resource.ErrorPage(resource.http.UNAUTHORIZED,
109+ unauthorized_resource = resource.ErrorPage(http.UNAUTHORIZED,
110 "Unauthorized",
111 "Unauthorized")
112 self.root.putChild(UNAUTHORIZED, unauthorized_resource)

Subscribers

People subscribed via source and target branches

to all changes: