Merge lp:~nataliabidart/ubuntu-sso-client/no-more-no into lp:ubuntu-sso-client

Proposed by Natalia Bidart
Status: Merged
Approved by: Natalia Bidart
Approved revision: 884
Merged at revision: 885
Proposed branch: lp:~nataliabidart/ubuntu-sso-client/no-more-no
Merge into: lp:ubuntu-sso-client
Diff against target: 91 lines (+10/-13)
4 files modified
ubuntu_sso/utils/runner/__init__.py (+7/-9)
ubuntu_sso/utils/runner/tests/test_glib.py (+0/-1)
ubuntu_sso/utils/runner/tests/test_qt.py (+0/-1)
ubuntu_sso/utils/runner/tests/test_runner.py (+3/-2)
To merge this branch: bzr merge lp:~nataliabidart/ubuntu-sso-client/no-more-no
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Manuel de la Peña (community) Approve
Review via email: mp+94368@code.launchpad.net

Commit message

- Stop using is_reactor_installed since is buggy (LP: #933644).

To post a comment you must log in.
Revision history for this message
Manuel de la Peña (mandel) wrote :

Great work! Done an IRL test with proxy support an everything went smoothly.

review: Approve
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ubuntu_sso/utils/runner/__init__.py'
2--- ubuntu_sso/utils/runner/__init__.py 2012-02-08 02:13:03 +0000
3+++ ubuntu_sso/utils/runner/__init__.py 2012-02-23 13:21:19 +0000
4@@ -37,6 +37,10 @@
5 def is_qt4_main_loop_installed():
6 """Check if the Qt4 main loop is installed."""
7 result = False
8+
9+ if not 'PyQt4' in sys.modules:
10+ return result
11+
12 try:
13 from PyQt4.QtCore import QCoreApplication
14 result = QCoreApplication.instance() is not None
15@@ -46,13 +50,7 @@
16 return result
17
18
19-def is_twisted_reactor_installed():
20- """Check if the Twisted reactor is installed."""
21- result = 'twisted.internet.reactor' in sys.modules
22- return result
23-
24-
25-def spawn_program(args):
26+def spawn_program(args, use_reactor=False):
27 """Spawn the program specified by 'args'.
28
29 - 'args' should be a sequence of program arguments, the program to execute
30@@ -67,10 +65,10 @@
31 logger.debug('spawn_program: requested to spawn %r.', repr(args))
32 d = defer.Deferred()
33
34- if is_twisted_reactor_installed():
35+ if use_reactor:
36 from ubuntu_sso.utils.runner import tx
37 source = tx
38- elif 'PyQt4' in sys.modules and is_qt4_main_loop_installed():
39+ elif is_qt4_main_loop_installed():
40 from ubuntu_sso.utils.runner import qt
41 source = qt
42 else:
43
44=== modified file 'ubuntu_sso/utils/runner/tests/test_glib.py'
45--- ubuntu_sso/utils/runner/tests/test_glib.py 2012-02-17 19:33:51 +0000
46+++ ubuntu_sso/utils/runner/tests/test_glib.py 2012-02-23 13:21:19 +0000
47@@ -106,7 +106,6 @@
48 # GLib.spawn_async and fake the conditions so the glib runner is chosen
49 self.process = FakedProcess()
50 self.patch(glib, 'GLib', self.process)
51- self.patch(runner, 'is_twisted_reactor_installed', lambda: False)
52 self.patch(runner, 'is_qt4_main_loop_installed', lambda: False)
53
54 # Access to a protected member _flags, _argv of a client class
55
56=== modified file 'ubuntu_sso/utils/runner/tests/test_qt.py'
57--- ubuntu_sso/utils/runner/tests/test_qt.py 2012-02-18 14:10:58 +0000
58+++ ubuntu_sso/utils/runner/tests/test_qt.py 2012-02-23 13:21:19 +0000
59@@ -99,7 +99,6 @@
60 # QProcess and fake the conditions so the qt runner is chosen
61 self.process = FakedProcess()
62 self.patch(QtCore, 'QProcess', lambda: self.process)
63- self.patch(runner, 'is_twisted_reactor_installed', lambda: False)
64 self.patch(runner, 'is_qt4_main_loop_installed', lambda: True)
65
66 @defer.inlineCallbacks
67
68=== modified file 'ubuntu_sso/utils/runner/tests/test_runner.py'
69--- ubuntu_sso/utils/runner/tests/test_runner.py 2012-02-17 20:58:53 +0000
70+++ ubuntu_sso/utils/runner/tests/test_runner.py 2012-02-23 13:21:19 +0000
71@@ -31,9 +31,10 @@
72 class SpawnProgramTestCase(TestCase):
73 """The test suite for the spawn_program method."""
74
75- timeout = 3
76 args = (u'python', u'-c',
77 u'import os; os.system("mkdir %s")' % TEST_ME_DIR)
78+ use_reactor = True
79+ timeout = 3
80
81 @defer.inlineCallbacks
82 def setUp(self):
83@@ -44,7 +45,7 @@
84
85 def spawn_fn(self, args):
86 """The target function to test."""
87- return runner.spawn_program(args)
88+ return runner.spawn_program(args, use_reactor=self.use_reactor)
89
90 def assert_command_was_run(self):
91 """The spawnned commnad was correctly run."""

Subscribers

People subscribed via source and target branches