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
=== modified file 'ubuntu_sso/utils/runner/__init__.py'
--- ubuntu_sso/utils/runner/__init__.py 2012-02-08 02:13:03 +0000
+++ ubuntu_sso/utils/runner/__init__.py 2012-02-23 13:21:19 +0000
@@ -37,6 +37,10 @@
37def is_qt4_main_loop_installed():37def is_qt4_main_loop_installed():
38 """Check if the Qt4 main loop is installed."""38 """Check if the Qt4 main loop is installed."""
39 result = False39 result = False
40
41 if not 'PyQt4' in sys.modules:
42 return result
43
40 try:44 try:
41 from PyQt4.QtCore import QCoreApplication45 from PyQt4.QtCore import QCoreApplication
42 result = QCoreApplication.instance() is not None46 result = QCoreApplication.instance() is not None
@@ -46,13 +50,7 @@
46 return result50 return result
4751
4852
49def is_twisted_reactor_installed():53def spawn_program(args, use_reactor=False):
50 """Check if the Twisted reactor is installed."""
51 result = 'twisted.internet.reactor' in sys.modules
52 return result
53
54
55def spawn_program(args):
56 """Spawn the program specified by 'args'.54 """Spawn the program specified by 'args'.
5755
58 - 'args' should be a sequence of program arguments, the program to execute56 - 'args' should be a sequence of program arguments, the program to execute
@@ -67,10 +65,10 @@
67 logger.debug('spawn_program: requested to spawn %r.', repr(args))65 logger.debug('spawn_program: requested to spawn %r.', repr(args))
68 d = defer.Deferred()66 d = defer.Deferred()
6967
70 if is_twisted_reactor_installed():68 if use_reactor:
71 from ubuntu_sso.utils.runner import tx69 from ubuntu_sso.utils.runner import tx
72 source = tx70 source = tx
73 elif 'PyQt4' in sys.modules and is_qt4_main_loop_installed():71 elif is_qt4_main_loop_installed():
74 from ubuntu_sso.utils.runner import qt72 from ubuntu_sso.utils.runner import qt
75 source = qt73 source = qt
76 else:74 else:
7775
=== modified file 'ubuntu_sso/utils/runner/tests/test_glib.py'
--- ubuntu_sso/utils/runner/tests/test_glib.py 2012-02-17 19:33:51 +0000
+++ ubuntu_sso/utils/runner/tests/test_glib.py 2012-02-23 13:21:19 +0000
@@ -106,7 +106,6 @@
106 # GLib.spawn_async and fake the conditions so the glib runner is chosen106 # GLib.spawn_async and fake the conditions so the glib runner is chosen
107 self.process = FakedProcess()107 self.process = FakedProcess()
108 self.patch(glib, 'GLib', self.process)108 self.patch(glib, 'GLib', self.process)
109 self.patch(runner, 'is_twisted_reactor_installed', lambda: False)
110 self.patch(runner, 'is_qt4_main_loop_installed', lambda: False)109 self.patch(runner, 'is_qt4_main_loop_installed', lambda: False)
111110
112 # Access to a protected member _flags, _argv of a client class111 # Access to a protected member _flags, _argv of a client class
113112
=== modified file 'ubuntu_sso/utils/runner/tests/test_qt.py'
--- ubuntu_sso/utils/runner/tests/test_qt.py 2012-02-18 14:10:58 +0000
+++ ubuntu_sso/utils/runner/tests/test_qt.py 2012-02-23 13:21:19 +0000
@@ -99,7 +99,6 @@
99 # QProcess and fake the conditions so the qt runner is chosen99 # QProcess and fake the conditions so the qt runner is chosen
100 self.process = FakedProcess()100 self.process = FakedProcess()
101 self.patch(QtCore, 'QProcess', lambda: self.process)101 self.patch(QtCore, 'QProcess', lambda: self.process)
102 self.patch(runner, 'is_twisted_reactor_installed', lambda: False)
103 self.patch(runner, 'is_qt4_main_loop_installed', lambda: True)102 self.patch(runner, 'is_qt4_main_loop_installed', lambda: True)
104103
105 @defer.inlineCallbacks104 @defer.inlineCallbacks
106105
=== modified file 'ubuntu_sso/utils/runner/tests/test_runner.py'
--- ubuntu_sso/utils/runner/tests/test_runner.py 2012-02-17 20:58:53 +0000
+++ ubuntu_sso/utils/runner/tests/test_runner.py 2012-02-23 13:21:19 +0000
@@ -31,9 +31,10 @@
31class SpawnProgramTestCase(TestCase):31class SpawnProgramTestCase(TestCase):
32 """The test suite for the spawn_program method."""32 """The test suite for the spawn_program method."""
3333
34 timeout = 3
35 args = (u'python', u'-c',34 args = (u'python', u'-c',
36 u'import os; os.system("mkdir %s")' % TEST_ME_DIR)35 u'import os; os.system("mkdir %s")' % TEST_ME_DIR)
36 use_reactor = True
37 timeout = 3
3738
38 @defer.inlineCallbacks39 @defer.inlineCallbacks
39 def setUp(self):40 def setUp(self):
@@ -44,7 +45,7 @@
4445
45 def spawn_fn(self, args):46 def spawn_fn(self, args):
46 """The target function to test."""47 """The target function to test."""
47 return runner.spawn_program(args)48 return runner.spawn_program(args, use_reactor=self.use_reactor)
4849
49 def assert_command_was_run(self):50 def assert_command_was_run(self):
50 """The spawnned commnad was correctly run."""51 """The spawnned commnad was correctly run."""

Subscribers

People subscribed via source and target branches