Merge lp:~nataliabidart/magicicada-client/fix-import-txsocketserver into lp:magicicada-client

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 1415
Merged at revision: 1415
Proposed branch: lp:~nataliabidart/magicicada-client/fix-import-txsocketserver
Merge into: lp:magicicada-client
Diff against target: 228 lines (+51/-14)
6 files modified
tests/platform/credentials/test_linux.py (+5/-2)
tests/platform/filesystem_notifications/test_fsevents_daemon.py (+10/-2)
tests/platform/ipc/test_linux.py (+4/-1)
tests/platform/ipc/test_perspective_broker.py (+28/-5)
tests/platform/os_helper/test_os_helper.py (+0/-2)
tests/platform/session/test_linux.py (+4/-2)
To merge this branch: bzr merge lp:~nataliabidart/magicicada-client/fix-import-txsocketserver
Reviewer Review Type Date Requested Status
Natalia Bidart Approve
Review via email: mp+271759@code.launchpad.net

Commit message

- Add try-except for devtools modules.

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Ran 2773 tests in 202.721s

PASSED (skips=43, successes=2730)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/platform/credentials/test_linux.py'
2--- tests/platform/credentials/test_linux.py 2015-09-17 02:20:40 +0000
3+++ tests/platform/credentials/test_linux.py 2015-09-20 21:25:01 +0000
4@@ -38,8 +38,11 @@
5
6 from twisted.internet.defer import Deferred, inlineCallbacks
7 from ubuntuone.devtools.handlers import MementoHandler
8-from ubuntuone.devtools.testcases import skipTest
9-from ubuntuone.devtools.testcases.dbus import DBusTestCase
10+try:
11+ from ubuntuone.devtools.testcases import skipTest
12+ from ubuntuone.devtools.testcases.dbus import DBusTestCase
13+except ImportError:
14+ from ubuntuone.devtools.testcase import DBusTestCase, skipTest
15
16 from ubuntuone.platform.credentials import (
17 CredentialsError,
18
19=== modified file 'tests/platform/filesystem_notifications/test_fsevents_daemon.py'
20--- tests/platform/filesystem_notifications/test_fsevents_daemon.py 2012-09-18 23:46:47 +0000
21+++ tests/platform/filesystem_notifications/test_fsevents_daemon.py 2015-09-20 21:25:01 +0000
22@@ -34,7 +34,13 @@
23
24 from contrib.testing.testcase import BaseTwistedTestCase
25 from ubuntuone import fseventsd
26-from ubuntuone.devtools.testcases.txsocketserver import TidyUnixServer
27+try:
28+ from ubuntuone.devtools.testcases import skipIf
29+ from ubuntuone.devtools.testcases.txsocketserver import TidyUnixServer
30+ TidyUnixServer = None
31+except ImportError:
32+ from ubuntuone.devtools.testcase import skipIf
33+ TidyUnixServer = None
34 from ubuntuone.platform.filesystem_notifications.monitor.darwin import (
35 fsevents_daemon,
36 )
37@@ -100,7 +106,7 @@
38 self.called = []
39
40 def loseConnection(self):
41- """"Lost the connection."""
42+ """Lost the connection."""
43 self.called.append('loseConnection')
44
45
46@@ -460,6 +466,8 @@
47 yield self.monitor.add_watch(dirpath)
48 self.assertNotIn('add_path', self.protocol.called)
49
50+ @skipIf(TidyUnixServer is None,
51+ 'Testcases from txsocketserver not availble.')
52 @defer.inlineCallbacks
53 def test_is_available_monitor_running(self):
54 """Test the method when it is indeed running."""
55
56=== modified file 'tests/platform/ipc/test_linux.py'
57--- tests/platform/ipc/test_linux.py 2015-09-19 21:04:46 +0000
58+++ tests/platform/ipc/test_linux.py 2015-09-20 21:25:01 +0000
59@@ -33,7 +33,10 @@
60 import dbus
61
62 from twisted.internet import defer
63-from ubuntuone.devtools.testcases.dbus import DBusTestCase
64+try:
65+ from ubuntuone.devtools.testcases.dbus import DBusTestCase
66+except ImportError:
67+ from ubuntuone.devtools.testcase import DBusTestCase
68
69 from contrib.testing.testcase import (
70 FakeMainTestCase,
71
72=== modified file 'tests/platform/ipc/test_perspective_broker.py'
73--- tests/platform/ipc/test_perspective_broker.py 2015-09-20 15:29:26 +0000
74+++ tests/platform/ipc/test_perspective_broker.py 2015-09-20 21:25:01 +0000
75@@ -45,11 +45,10 @@
76 FakedService,
77 FakeMainTestCase,
78 )
79-from ubuntuone.devtools.testcases import skipIfOS
80-from ubuntuone.devtools.testcases.txsocketserver import (
81- TidyUnixServer,
82- TCPPbServerTestCase,
83-)
84+try:
85+ from ubuntuone.devtools.testcases import skipTest, skipIf, skipIfOS
86+except ImportError:
87+ from ubuntuone.devtools.testcase import skipTest, skipIf, skipIfOS
88 from ubuntuone.platform.ipc import perspective_broker as ipc
89 from ubuntuone.platform.ipc.perspective_broker import (
90 Config,
91@@ -82,6 +81,19 @@
92 except ImportError:
93 from ubuntu_sso.networkstate import ONLINE
94
95+
96+class NoTestCase(object):
97+ """Dummy class to be used when txsocketserver is not available."""
98+
99+try:
100+ from ubuntuone.devtools.testcases.txsocketserver import (
101+ TidyUnixServer,
102+ TCPPbServerTestCase,
103+ )
104+except ImportError:
105+ TidyUnixServer = None
106+ TCPPbServerTestCase = NoTestCase
107+
108 TEST_PORT = 40404
109 TEST_DOMAIN_SOCKET = os.path.join(basedir.xdg_cache_home, 'ubuntuone', 'ipc')
110
111@@ -381,6 +393,8 @@
112 self.assertEqual(fake_remote_object.called, expected)
113
114
115+@skipIf(TCPPbServerTestCase is NoTestCase,
116+ 'Testcases from txsocketserver not availble.')
117 class IPCTestCase(FakeMainTestCase, TCPPbServerTestCase):
118 """Set the ipc to a random port for this instance."""
119
120@@ -554,6 +568,7 @@
121 client_class = StatusClient
122
123
124+@skipIf(TidyUnixServer is None, 'Testcases from txsocketserver not availble.')
125 @skipIfOS('win32', 'Unix domain sockets not supported on windows.')
126 class DUSStatusTestCase(StatusTestCase):
127 """Test the status client class."""
128@@ -569,6 +584,7 @@
129 client_class = EventsClient
130
131
132+@skipIf(TidyUnixServer is None, 'Testcases from txsocketserver not availble.')
133 @skipIfOS('win32', 'Unix domain sockets not supported on windows.')
134 class DUSEventsTestCase(EventsTestCase):
135 """Test the events client class."""
136@@ -584,6 +600,7 @@
137 client_class = SyncDaemonClient
138
139
140+@skipIf(TidyUnixServer is None, 'Testcases from txsocketserver not availble.')
141 @skipIfOS('win32', 'Unix domain sockets not supported on windows.')
142 class DUSSyncDaemonTestCase(SyncDaemonTestCase):
143 """Test the syncdaemon client class."""
144@@ -599,6 +616,7 @@
145 client_class = FileSystemClient
146
147
148+@skipIf(TidyUnixServer is None, 'Testcases from txsocketserver not availble.')
149 @skipIfOS('win32', 'Unix domain sockets not supported on windows.')
150 class DUSFileSystemTestCase(FileSystemTestCase):
151 """Test the file system client class."""
152@@ -614,6 +632,7 @@
153 client_class = SharesClient
154
155
156+@skipIf(TidyUnixServer is None, 'Testcases from txsocketserver not availble.')
157 @skipIfOS('win32', 'Unix domain sockets not supported on windows.')
158 class DUSSharesTestCase(SharesTestCase):
159 """Test the shares client class."""
160@@ -629,6 +648,7 @@
161 client_class = ConfigClient
162
163
164+@skipIf(TidyUnixServer is None, 'Testcases from txsocketserver not availble.')
165 @skipIfOS('win32', 'Unix domain sockets not supported on windows.')
166 class DUSConfigTestCase(ConfigTestCase):
167 """Test the status client class."""
168@@ -644,6 +664,7 @@
169 client_class = FoldersClient
170
171
172+@skipIf(TidyUnixServer is None, 'Testcases from txsocketserver not availble.')
173 @skipIfOS('win32', 'Unix domain sockets not supported on windows.')
174 class DUSFoldersTestCase(FoldersTestCase):
175 """Test the status client class."""
176@@ -659,6 +680,7 @@
177 client_class = PublicFilesClient
178
179
180+@skipIf(TidyUnixServer is None, 'Testcases from txsocketserver not availble.')
181 @skipIfOS('win32', 'Unix domain sockets not supported on windows.')
182 class DUSPublicFilesTestCase(PublicFilesTestCase):
183 """Test the status client class."""
184@@ -786,6 +808,7 @@
185 self.assertIsInstance(remote, RemoteReference)
186
187
188+@skipIf(TidyUnixServer is None, 'Testcases from txsocketserver not availble.')
189 @skipIfOS('win32', 'Unix domain sockets not supported on windows.')
190 class DUSInterfaceTestCase(IPCInterfaceTestCase):
191 """Ensure that the IPCInterface works as expected."""
192
193=== modified file 'tests/platform/os_helper/test_os_helper.py'
194--- tests/platform/os_helper/test_os_helper.py 2012-05-16 16:33:49 +0000
195+++ tests/platform/os_helper/test_os_helper.py 2015-09-20 21:25:01 +0000
196@@ -40,7 +40,6 @@
197 BaseTwistedTestCase,
198 skip_if_win32_and_uses_readonly,
199 )
200-from ubuntuone.devtools.testcases import skipIfJenkins
201 from ubuntuone.platform import (
202 access,
203 allow_writes,
204@@ -133,7 +132,6 @@
205 os.mkdir(foo_dir)
206 self.assertTrue(path_exists(foo_dir))
207
208- @skipIfJenkins("win32", "Fails due to Jenkins setup on Windows")
209 def test_set_file_readonly(self):
210 """Test for set_file_readonly."""
211 set_file_readonly(self.testfile)
212
213=== modified file 'tests/platform/session/test_linux.py'
214--- tests/platform/session/test_linux.py 2012-06-26 15:02:12 +0000
215+++ tests/platform/session/test_linux.py 2015-09-20 21:25:01 +0000
216@@ -35,8 +35,10 @@
217
218 from dbus.mainloop.glib import DBusGMainLoop
219 from twisted.internet.defer import inlineCallbacks
220-from ubuntuone.devtools.testcases.dbus import DBusTestCase
221-
222+try:
223+ from ubuntuone.devtools.testcases.dbus import DBusTestCase
224+except ImportError:
225+ from ubuntuone.devtools.testcase import DBusTestCase
226 from ubuntuone.platform import session
227
228 INHIBIT_ALL = (session.INHIBIT_LOGGING_OUT |

Subscribers

People subscribed via source and target branches

to all changes: