Merge lp:~frankban/juju-quickstart/interactive-errors into lp:juju-quickstart

Proposed by Francesco Banconi
Status: Merged
Merged at revision: 102
Proposed branch: lp:~frankban/juju-quickstart/interactive-errors
Merge into: lp:juju-quickstart
Diff against target: 41 lines (+10/-2)
2 files modified
quickstart/cli/views.py (+7/-1)
quickstart/tests/cli/test_views.py (+3/-1)
To merge this branch: bzr merge lp:~frankban/juju-quickstart/interactive-errors
Reviewer Review Type Date Requested Status
Juju GUI Hackers Pending
Review via email: mp+241276@code.launchpad.net

Description of the change

Do not hide errors on interactive session.

https://codereview.appspot.com/166420044/

To post a comment you must log in.
Revision history for this message
Francesco Banconi (frankban) wrote :

Reviewers: mp+241276_code.launchpad.net,

Message:
Please take a look.

Description:
Do not hide errors on interactive session.

https://code.launchpad.net/~frankban/juju-quickstart/interactive-errors/+merge/241276

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/166420044/

Affected files (+12, -2 lines):
   A [revision details]
   M quickstart/cli/views.py
   M quickstart/tests/cli/test_views.py

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision:
<email address hidden>
+New revision:
<email address hidden>

Index: quickstart/cli/views.py
=== modified file 'quickstart/cli/views.py'
--- quickstart/cli/views.py 2014-10-09 13:35:12 +0000
+++ quickstart/cli/views.py 2014-11-10 14:11:11 +0000
@@ -94,7 +94,10 @@
  proposed solution to build multi-views CLI applications in Quickstart.
  """

-from __future__ import unicode_literals
+from __future__ import (
+ print_function,
+ unicode_literals,
+)

  import copy
  import functools
@@ -131,6 +134,9 @@
          # Start the Urwid interactive session (main loop).
          loop.run()
      except ui.AppExit as err:
+ # The print below ensures the screen is properly refreshed when
+ # exiting the interactive session.
+ print('interactive session closed')
          return err.return_value

Index: quickstart/tests/cli/test_views.py
=== modified file 'quickstart/tests/cli/test_views.py'
--- quickstart/tests/cli/test_views.py 2014-10-10 08:54:46 +0000
+++ quickstart/tests/cli/test_views.py 2014-11-10 14:11:11 +0000
@@ -110,8 +110,10 @@
          view = mock.Mock()
          run_side_effect = ui.AppExit('bad wolf')
          with self.patch_setup_urwid_app(run_side_effect=run_side_effect):
- return_value = views.show(view)
+ with helpers.mock_print as mock_print:
+ return_value = views.show(view)
          self.assertEqual('bad wolf', return_value)
+ mock_print.assert_called_once_with('interactive session closed')

      def test_view_arguments(self):
          # The view is invoked passing the app and all the optional show

Revision history for this message
Jay R. Wren (evarlast) wrote :
Revision history for this message
Brad Crittenden (bac) wrote :

On 2014/11/10 14:28:42, jay.wren wrote:
> lgtm

LGTM too. No QA b/c I don't know how to invoke the errors needed to
exercise it.

https://codereview.appspot.com/166420044/

Revision history for this message
Francesco Banconi (frankban) wrote :

*** Submitted:

Do not hide errors on interactive session.

R=jay.wren, bac
CC=
https://codereview.appspot.com/166420044

https://codereview.appspot.com/166420044/

Revision history for this message
Francesco Banconi (frankban) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'quickstart/cli/views.py'
2--- quickstart/cli/views.py 2014-10-09 13:35:12 +0000
3+++ quickstart/cli/views.py 2014-11-10 14:13:46 +0000
4@@ -94,7 +94,10 @@
5 proposed solution to build multi-views CLI applications in Quickstart.
6 """
7
8-from __future__ import unicode_literals
9+from __future__ import (
10+ print_function,
11+ unicode_literals,
12+)
13
14 import copy
15 import functools
16@@ -131,6 +134,9 @@
17 # Start the Urwid interactive session (main loop).
18 loop.run()
19 except ui.AppExit as err:
20+ # The print below ensures the screen is properly refreshed when
21+ # exiting the interactive session.
22+ print('interactive session closed')
23 return err.return_value
24
25
26
27=== modified file 'quickstart/tests/cli/test_views.py'
28--- quickstart/tests/cli/test_views.py 2014-10-10 08:54:46 +0000
29+++ quickstart/tests/cli/test_views.py 2014-11-10 14:13:46 +0000
30@@ -110,8 +110,10 @@
31 view = mock.Mock()
32 run_side_effect = ui.AppExit('bad wolf')
33 with self.patch_setup_urwid_app(run_side_effect=run_side_effect):
34- return_value = views.show(view)
35+ with helpers.mock_print as mock_print:
36+ return_value = views.show(view)
37 self.assertEqual('bad wolf', return_value)
38+ mock_print.assert_called_once_with('interactive session closed')
39
40 def test_view_arguments(self):
41 # The view is invoked passing the app and all the optional show

Subscribers

People subscribed via source and target branches