)]}'
{"novaclient/tests/unit/test_shell.py":[{"author":{"_account_id":679,"name":"Kevin L. Mitchell","email":"klmitch@mit.edu","username":"klmitch"},"change_message_id":"06f6099282f430b4ea845bccfa8ebc3def860cd6","unresolved":false,"context_lines":[{"line_number":525,"context_line":"    def test_main_error_handling(self, mock_compute_shell):"},{"line_number":526,"context_line":"        mock_compute_shell.side_effect \u003d Exception(\u0027message\u0027)"},{"line_number":527,"context_line":"        orig \u003d sys.stderr"},{"line_number":528,"context_line":"        sys.stderr \u003d six.StringIO()"},{"line_number":529,"context_line":""},{"line_number":530,"context_line":"        try:"},{"line_number":531,"context_line":"            self.assertRaises(SystemExit, novaclient.shell.main)"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba15a1d1_5e741e9b","line":528,"updated":"2015-09-14 15:56:30.000000000","message":"I\u0027d be a bit more comfortable if you used a mock to do this.  My usual idiom is something like this (note too the use of \"side_effect\u003d\" in the compute shell mock):\n\n    @mock.patch.object(sys, \u0027stderr\u0027, six.StringIO())\n    @mock.patch.object(novaclient.shell.OpenStackComputeShell, \u0027main\u0027,\n                       side_effect\u003dException(\u0027message\u0027))\n    def test_main_error_handling(self, mock_compute_shell):\n        self.assertRaises(SystemExit, novaclient.shell.main)\n        self.assertEqual(sys.stderr.getvalue(), \u0027Error (Exception): message\\n\u0027)\n\nAlso, it would probably be better to use something other than generic Exception.  Many of the other OpenStack test suites include a definition for a TestingException that\u0027s then used in cases like this.  It\u0027s not strictly necessary for this particular case, but it\u0027d be good to start the convention in novaclient…","commit_id":"3a40e894275f267b8b532b9b5797bfa485645a79"},{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"bc2dec9b31215645ffbeb64686ab956318e9336d","unresolved":false,"context_lines":[{"line_number":525,"context_line":"    def test_main_error_handling(self, mock_compute_shell):"},{"line_number":526,"context_line":"        mock_compute_shell.side_effect \u003d Exception(\u0027message\u0027)"},{"line_number":527,"context_line":"        orig \u003d sys.stderr"},{"line_number":528,"context_line":"        sys.stderr \u003d six.StringIO()"},{"line_number":529,"context_line":""},{"line_number":530,"context_line":"        try:"},{"line_number":531,"context_line":"            self.assertRaises(SystemExit, novaclient.shell.main)"}],"source_content_type":"text/x-python","patch_set":1,"id":"ba15a1d1_ef20c59d","line":528,"in_reply_to":"ba15a1d1_5e741e9b","updated":"2015-09-15 07:57:46.000000000","message":"\"I\u0027d be a bit more comfortable if you used a mock to do this. \"\n\nOk, done.\n\n\"Also, it would probably be better to use something other than generic Exception.\"\n\nOk, done.","commit_id":"3a40e894275f267b8b532b9b5797bfa485645a79"}]}
