)]}'
{"hacking/tests/checks/test_imports.py":[{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"9873b66b4a7e34bec2f1e4be3c20fe236a931aa8","unresolved":false,"context_lines":[{"line_number":30,"context_line":"        return (None, \u0027./oslo\u0027, None)"},{"line_number":31,"context_line":"    elif module \u003d\u003d \u0027db\u0027 and path[0] \u003d\u003d \u0027./oslo\u0027:"},{"line_number":32,"context_line":"        return (None, \u0027./oslo/db\u0027, None)"},{"line_number":33,"context_line":"    elif module \u003d\u003d \u0027xyz\u0027 and path[0] \u003d\u003d \u0027./oslo/db\u0027:"},{"line_number":34,"context_line":"        # Let\u0027s fake, there is xyz.py at ./oslo/db/"},{"line_number":35,"context_line":"        return (None, \u0027./oslo/db/xyz\u0027, None)"},{"line_number":36,"context_line":"    elif module \u003d\u003d \u0027abc\u0027 and path[0] \u003d\u003d \u0027./oslo/db\u0027:"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_9ecdf733","line":33,"updated":"2014-11-24 19:28:17.000000000","message":"Nit: I\u0027m not sure this is necessary.  I think the case on line 39 takes care of submodules of oslo.db.","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":14071,"name":"Surojit Pathak","username":"suropatz","inactive":true},"change_message_id":"2bdc1beb2eb5201ba7cd736162929e6b6f6188e1","unresolved":false,"context_lines":[{"line_number":30,"context_line":"        return (None, \u0027./oslo\u0027, None)"},{"line_number":31,"context_line":"    elif module \u003d\u003d \u0027db\u0027 and path[0] \u003d\u003d \u0027./oslo\u0027:"},{"line_number":32,"context_line":"        return (None, \u0027./oslo/db\u0027, None)"},{"line_number":33,"context_line":"    elif module \u003d\u003d \u0027xyz\u0027 and path[0] \u003d\u003d \u0027./oslo/db\u0027:"},{"line_number":34,"context_line":"        # Let\u0027s fake, there is xyz.py at ./oslo/db/"},{"line_number":35,"context_line":"        return (None, \u0027./oslo/db/xyz\u0027, None)"},{"line_number":36,"context_line":"    elif module \u003d\u003d \u0027abc\u0027 and path[0] \u003d\u003d \u0027./oslo/db\u0027:"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_29f68b8f","line":33,"in_reply_to":"5a890539_9ecdf733","updated":"2014-11-24 20:22:24.000000000","message":"Ben, agreed.\n\nMy intention was to put an explicit statement for availability of \u0027xyz\u0027. \nBut this can be removed.","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"c45668e5dc8228eab638547614464f938732144e","unresolved":false,"context_lines":[{"line_number":68,"context_line":"    def test_module_import(self, find_module, mock_import):"},{"line_number":69,"context_line":"        find_module.side_effect \u003d fake_find_module"},{"line_number":70,"context_line":"        path \u003d sys.path"},{"line_number":71,"context_line":"        sys.path \u003d \u0027.\u0027"},{"line_number":72,"context_line":"        # API under test"},{"line_number":73,"context_line":"        aut \u003d imports.hacking_import_rules"},{"line_number":74,"context_line":"        for _, str in aut(\u0027from oslo.db import xyz\u0027, None, \u0027fake_file.py\u0027, 0):"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_c9798783","line":71,"updated":"2014-11-24 19:43:03.000000000","message":"This seems bad to do ;)\n\nIsn\u0027t there another way?\n\nModifying a system path that is used in all tests sorta seems unsafe/bad.","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"76edc8ab012cde0e6d7a7089cfbd5be0794b6a3a","unresolved":false,"context_lines":[{"line_number":68,"context_line":"    def test_module_import(self, find_module, mock_import):"},{"line_number":69,"context_line":"        find_module.side_effect \u003d fake_find_module"},{"line_number":70,"context_line":"        path \u003d sys.path"},{"line_number":71,"context_line":"        sys.path \u003d \u0027.\u0027"},{"line_number":72,"context_line":"        # API under test"},{"line_number":73,"context_line":"        aut \u003d imports.hacking_import_rules"},{"line_number":74,"context_line":"        for _, str in aut(\u0027from oslo.db import xyz\u0027, None, \u0027fake_file.py\u0027, 0):"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_29492b31","line":71,"in_reply_to":"5a890539_c9798783","updated":"2014-11-24 19:45:01.000000000","message":"I wonder if it\u0027s even necessary.  We\u0027re faking out the actual module search, so the real sys.path shouldn\u0027t matter.","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":14071,"name":"Surojit Pathak","username":"suropatz","inactive":true},"change_message_id":"2bdc1beb2eb5201ba7cd736162929e6b6f6188e1","unresolved":false,"context_lines":[{"line_number":68,"context_line":"    def test_module_import(self, find_module, mock_import):"},{"line_number":69,"context_line":"        find_module.side_effect \u003d fake_find_module"},{"line_number":70,"context_line":"        path \u003d sys.path"},{"line_number":71,"context_line":"        sys.path \u003d \u0027.\u0027"},{"line_number":72,"context_line":"        # API under test"},{"line_number":73,"context_line":"        aut \u003d imports.hacking_import_rules"},{"line_number":74,"context_line":"        for _, str in aut(\u0027from oslo.db import xyz\u0027, None, \u0027fake_file.py\u0027, 0):"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_a950bb32","line":71,"in_reply_to":"5a890539_c9798783","updated":"2014-11-24 20:22:24.000000000","message":"is_module_for_sure() calls imp.find_module() with param \u0027path\u0027 which is set to \u0027sys.path\u0027 internally in is_module_for_sure(search_path\u003dsys.path).\n\nI could not think of any other way that modify-use-and-restore of sys.path. Please suggest, if there is a better way.","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":1297,"name":"Joshua Harlow","email":"jxharlow@godaddy.com","username":"harlowja"},"change_message_id":"10f966ca079de8d5332e07150d31f62ffe44d396","unresolved":false,"context_lines":[{"line_number":71,"context_line":"        sys.path \u003d \u0027.\u0027"},{"line_number":72,"context_line":"        # API under test"},{"line_number":73,"context_line":"        aut \u003d imports.hacking_import_rules"},{"line_number":74,"context_line":"        for _, str in aut(\u0027from oslo.db import xyz\u0027, None, \u0027fake_file.py\u0027, 0):"},{"line_number":75,"context_line":"            # xyz should be found and this generator should be empty"},{"line_number":76,"context_line":"            self.assertEqual(\u0027True\u0027, \u0027False\u0027)"},{"line_number":77,"context_line":"        for _, str in aut(\u0027from oslo.db import abc\u0027, None, \u0027fake_file.py\u0027, 0):"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_c9a267fb","line":74,"updated":"2014-11-24 19:42:10.000000000","message":"Also don\u0027t use _ as it shadows gettext...","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"9873b66b4a7e34bec2f1e4be3c20fe236a931aa8","unresolved":false,"context_lines":[{"line_number":71,"context_line":"        sys.path \u003d \u0027.\u0027"},{"line_number":72,"context_line":"        # API under test"},{"line_number":73,"context_line":"        aut \u003d imports.hacking_import_rules"},{"line_number":74,"context_line":"        for _, str in aut(\u0027from oslo.db import xyz\u0027, None, \u0027fake_file.py\u0027, 0):"},{"line_number":75,"context_line":"            # xyz should be found and this generator should be empty"},{"line_number":76,"context_line":"            self.assertEqual(\u0027True\u0027, \u0027False\u0027)"},{"line_number":77,"context_line":"        for _, str in aut(\u0027from oslo.db import abc\u0027, None, \u0027fake_file.py\u0027, 0):"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_fe3fdb22","line":74,"updated":"2014-11-24 19:28:17.000000000","message":"Please don\u0027t use `str` as an identifier.  It shadows the built-in name.","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":14071,"name":"Surojit Pathak","username":"suropatz","inactive":true},"change_message_id":"2bdc1beb2eb5201ba7cd736162929e6b6f6188e1","unresolved":false,"context_lines":[{"line_number":71,"context_line":"        sys.path \u003d \u0027.\u0027"},{"line_number":72,"context_line":"        # API under test"},{"line_number":73,"context_line":"        aut \u003d imports.hacking_import_rules"},{"line_number":74,"context_line":"        for _, str in aut(\u0027from oslo.db import xyz\u0027, None, \u0027fake_file.py\u0027, 0):"},{"line_number":75,"context_line":"            # xyz should be found and this generator should be empty"},{"line_number":76,"context_line":"            self.assertEqual(\u0027True\u0027, \u0027False\u0027)"},{"line_number":77,"context_line":"        for _, str in aut(\u0027from oslo.db import abc\u0027, None, \u0027fake_file.py\u0027, 0):"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_e946437a","line":74,"in_reply_to":"5a890539_c9a267fb","updated":"2014-11-24 20:22:24.000000000","message":"Done","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":14071,"name":"Surojit Pathak","username":"suropatz","inactive":true},"change_message_id":"2bdc1beb2eb5201ba7cd736162929e6b6f6188e1","unresolved":false,"context_lines":[{"line_number":71,"context_line":"        sys.path \u003d \u0027.\u0027"},{"line_number":72,"context_line":"        # API under test"},{"line_number":73,"context_line":"        aut \u003d imports.hacking_import_rules"},{"line_number":74,"context_line":"        for _, str in aut(\u0027from oslo.db import xyz\u0027, None, \u0027fake_file.py\u0027, 0):"},{"line_number":75,"context_line":"            # xyz should be found and this generator should be empty"},{"line_number":76,"context_line":"            self.assertEqual(\u0027True\u0027, \u0027False\u0027)"},{"line_number":77,"context_line":"        for _, str in aut(\u0027from oslo.db import abc\u0027, None, \u0027fake_file.py\u0027, 0):"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_c9418764","line":74,"in_reply_to":"5a890539_fe3fdb22","updated":"2014-11-24 20:22:24.000000000","message":"Done","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"9873b66b4a7e34bec2f1e4be3c20fe236a931aa8","unresolved":false,"context_lines":[{"line_number":73,"context_line":"        aut \u003d imports.hacking_import_rules"},{"line_number":74,"context_line":"        for _, str in aut(\u0027from oslo.db import xyz\u0027, None, \u0027fake_file.py\u0027, 0):"},{"line_number":75,"context_line":"            # xyz should be found and this generator should be empty"},{"line_number":76,"context_line":"            self.assertEqual(\u0027True\u0027, \u0027False\u0027)"},{"line_number":77,"context_line":"        for _, str in aut(\u0027from oslo.db import abc\u0027, None, \u0027fake_file.py\u0027, 0):"},{"line_number":78,"context_line":"            # abc should not be found and we should get H302"},{"line_number":79,"context_line":"            self.assertEqual(0, str.find(\u0027H302\u0027))"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_dee93fb8","line":76,"updated":"2014-11-24 19:28:17.000000000","message":"This can\u0027t possibly work, can it?","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":14071,"name":"Surojit Pathak","username":"suropatz","inactive":true},"change_message_id":"2b6df90a735a020063a759b47d033c47135c8ee0","unresolved":false,"context_lines":[{"line_number":73,"context_line":"        aut \u003d imports.hacking_import_rules"},{"line_number":74,"context_line":"        for _, str in aut(\u0027from oslo.db import xyz\u0027, None, \u0027fake_file.py\u0027, 0):"},{"line_number":75,"context_line":"            # xyz should be found and this generator should be empty"},{"line_number":76,"context_line":"            self.assertEqual(\u0027True\u0027, \u0027False\u0027)"},{"line_number":77,"context_line":"        for _, str in aut(\u0027from oslo.db import abc\u0027, None, \u0027fake_file.py\u0027, 0):"},{"line_number":78,"context_line":"            # abc should not be found and we should get H302"},{"line_number":79,"context_line":"            self.assertEqual(0, str.find(\u0027H302\u0027))"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_3bd8901d","line":76,"in_reply_to":"5a890539_784bfe86","updated":"2014-11-25 00:45:57.000000000","message":"Done","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"7a4dce7e6eddab279a4034459d04eeb631fb7840","unresolved":false,"context_lines":[{"line_number":73,"context_line":"        aut \u003d imports.hacking_import_rules"},{"line_number":74,"context_line":"        for _, str in aut(\u0027from oslo.db import xyz\u0027, None, \u0027fake_file.py\u0027, 0):"},{"line_number":75,"context_line":"            # xyz should be found and this generator should be empty"},{"line_number":76,"context_line":"            self.assertEqual(\u0027True\u0027, \u0027False\u0027)"},{"line_number":77,"context_line":"        for _, str in aut(\u0027from oslo.db import abc\u0027, None, \u0027fake_file.py\u0027, 0):"},{"line_number":78,"context_line":"            # abc should not be found and we should get H302"},{"line_number":79,"context_line":"            self.assertEqual(0, str.find(\u0027H302\u0027))"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_784bfe86","line":76,"in_reply_to":"5a890539_844e866d","updated":"2014-11-24 21:58:59.000000000","message":"Ah, okay.  In that case, I\u0027d prefer self.fail(), or even better something like self.assertEqual([], aut(...)) (or maybe None?  Off the top of my head I don\u0027t know what would be returned in this case).","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":14071,"name":"Surojit Pathak","username":"suropatz","inactive":true},"change_message_id":"2bdc1beb2eb5201ba7cd736162929e6b6f6188e1","unresolved":false,"context_lines":[{"line_number":73,"context_line":"        aut \u003d imports.hacking_import_rules"},{"line_number":74,"context_line":"        for _, str in aut(\u0027from oslo.db import xyz\u0027, None, \u0027fake_file.py\u0027, 0):"},{"line_number":75,"context_line":"            # xyz should be found and this generator should be empty"},{"line_number":76,"context_line":"            self.assertEqual(\u0027True\u0027, \u0027False\u0027)"},{"line_number":77,"context_line":"        for _, str in aut(\u0027from oslo.db import abc\u0027, None, \u0027fake_file.py\u0027, 0):"},{"line_number":78,"context_line":"            # abc should not be found and we should get H302"},{"line_number":79,"context_line":"            self.assertEqual(0, str.find(\u0027H302\u0027))"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_844e866d","line":76,"in_reply_to":"5a890539_dee93fb8","updated":"2014-11-24 20:22:24.000000000","message":"Ben,\nAs the comment suggests, the expectation is that the assert will not be executed. I composed this as assert(0), a statement affirming failure, if executed. Suggestion for better alternative is welcome.\n\nBtw, if I remove the fix in imports.py, this case ensures the failure, thus the bug gets caught, and the fix helps not to hit the assert.","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"9873b66b4a7e34bec2f1e4be3c20fe236a931aa8","unresolved":false,"context_lines":[{"line_number":76,"context_line":"            self.assertEqual(\u0027True\u0027, \u0027False\u0027)"},{"line_number":77,"context_line":"        for _, str in aut(\u0027from oslo.db import abc\u0027, None, \u0027fake_file.py\u0027, 0):"},{"line_number":78,"context_line":"            # abc should not be found and we should get H302"},{"line_number":79,"context_line":"            self.assertEqual(0, str.find(\u0027H302\u0027))"},{"line_number":80,"context_line":"        for _, str in aut(\u0027from oslo.db.myz import *\u0027, None, \u0027fake_file.py\u0027,"},{"line_number":81,"context_line":"                          0):"},{"line_number":82,"context_line":"            # wildcard import is not allowed as per H303"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_7e2ccb02","line":79,"updated":"2014-11-24 19:28:17.000000000","message":"This doesn\u0027t seem to match the behavior described in the comment.  It\u0027s asserting that there was no H302 error.\n\nAlso, I would prefer to use assertIn(\u0027H302\u0027, msg) for checking if a string is in another string.","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"7a4dce7e6eddab279a4034459d04eeb631fb7840","unresolved":false,"context_lines":[{"line_number":76,"context_line":"            self.assertEqual(\u0027True\u0027, \u0027False\u0027)"},{"line_number":77,"context_line":"        for _, str in aut(\u0027from oslo.db import abc\u0027, None, \u0027fake_file.py\u0027, 0):"},{"line_number":78,"context_line":"            # abc should not be found and we should get H302"},{"line_number":79,"context_line":"            self.assertEqual(0, str.find(\u0027H302\u0027))"},{"line_number":80,"context_line":"        for _, str in aut(\u0027from oslo.db.myz import *\u0027, None, \u0027fake_file.py\u0027,"},{"line_number":81,"context_line":"                          0):"},{"line_number":82,"context_line":"            # wildcard import is not allowed as per H303"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_b83806ef","line":79,"in_reply_to":"5a890539_64b35a4d","updated":"2014-11-24 21:58:59.000000000","message":"Whoops, been a long time since I\u0027ve used find on a string in Python. :-)\n\nI think for the sake of clarity I would prefer self.assertTrue(msg.startswith(\u0027H302\u0027)) then.","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":14071,"name":"Surojit Pathak","username":"suropatz","inactive":true},"change_message_id":"2bdc1beb2eb5201ba7cd736162929e6b6f6188e1","unresolved":false,"context_lines":[{"line_number":76,"context_line":"            self.assertEqual(\u0027True\u0027, \u0027False\u0027)"},{"line_number":77,"context_line":"        for _, str in aut(\u0027from oslo.db import abc\u0027, None, \u0027fake_file.py\u0027, 0):"},{"line_number":78,"context_line":"            # abc should not be found and we should get H302"},{"line_number":79,"context_line":"            self.assertEqual(0, str.find(\u0027H302\u0027))"},{"line_number":80,"context_line":"        for _, str in aut(\u0027from oslo.db.myz import *\u0027, None, \u0027fake_file.py\u0027,"},{"line_number":81,"context_line":"                          0):"},{"line_number":82,"context_line":"            # wildcard import is not allowed as per H303"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_64b35a4d","line":79,"in_reply_to":"5a890539_7e2ccb02","updated":"2014-11-24 20:22:24.000000000","message":"Ben,\nThe intention was to confirm that the string/msg starts with \u0027H302\u0027. string.find() returns the index, comparing with 0 to ensure, substring\u0027s position in the message.","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":14071,"name":"Surojit Pathak","username":"suropatz","inactive":true},"change_message_id":"2b6df90a735a020063a759b47d033c47135c8ee0","unresolved":false,"context_lines":[{"line_number":76,"context_line":"            self.assertEqual(\u0027True\u0027, \u0027False\u0027)"},{"line_number":77,"context_line":"        for _, str in aut(\u0027from oslo.db import abc\u0027, None, \u0027fake_file.py\u0027, 0):"},{"line_number":78,"context_line":"            # abc should not be found and we should get H302"},{"line_number":79,"context_line":"            self.assertEqual(0, str.find(\u0027H302\u0027))"},{"line_number":80,"context_line":"        for _, str in aut(\u0027from oslo.db.myz import *\u0027, None, \u0027fake_file.py\u0027,"},{"line_number":81,"context_line":"                          0):"},{"line_number":82,"context_line":"            # wildcard import is not allowed as per H303"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_bbfba079","line":79,"in_reply_to":"5a890539_b83806ef","updated":"2014-11-25 00:45:57.000000000","message":"Done","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"9873b66b4a7e34bec2f1e4be3c20fe236a931aa8","unresolved":false,"context_lines":[{"line_number":80,"context_line":"        for _, str in aut(\u0027from oslo.db.myz import *\u0027, None, \u0027fake_file.py\u0027,"},{"line_number":81,"context_line":"                          0):"},{"line_number":82,"context_line":"            # wildcard import is not allowed as per H303"},{"line_number":83,"context_line":"            self.assertEqual(0, str.find(\u0027H303\u0027))"},{"line_number":84,"context_line":"        sys.path \u003d path"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_5e438fae","line":83,"updated":"2014-11-24 19:28:17.000000000","message":"Same comment.","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":14071,"name":"Surojit Pathak","username":"suropatz","inactive":true},"change_message_id":"2bdc1beb2eb5201ba7cd736162929e6b6f6188e1","unresolved":false,"context_lines":[{"line_number":80,"context_line":"        for _, str in aut(\u0027from oslo.db.myz import *\u0027, None, \u0027fake_file.py\u0027,"},{"line_number":81,"context_line":"                          0):"},{"line_number":82,"context_line":"            # wildcard import is not allowed as per H303"},{"line_number":83,"context_line":"            self.assertEqual(0, str.find(\u0027H303\u0027))"},{"line_number":84,"context_line":"        sys.path \u003d path"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_c4796e83","line":83,"in_reply_to":"5a890539_5e438fae","updated":"2014-11-24 20:22:24.000000000","message":"Ben, The intention was to confirm that the string/msg starts with \u0027H303\u0027 - string.find() returns the index, comparing with 0 to ensure, substring\u0027s position in the message.","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"9873b66b4a7e34bec2f1e4be3c20fe236a931aa8","unresolved":false,"context_lines":[{"line_number":81,"context_line":"                          0):"},{"line_number":82,"context_line":"            # wildcard import is not allowed as per H303"},{"line_number":83,"context_line":"            self.assertEqual(0, str.find(\u0027H303\u0027))"},{"line_number":84,"context_line":"        sys.path \u003d path"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_5e1aafc6","line":84,"updated":"2014-11-24 19:28:17.000000000","message":"Please do this as a testcase cleanup operation so it happens even if one of the asserts above fails.  Otherwise the sys.path override may leak into other tests.","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":14071,"name":"Surojit Pathak","username":"suropatz","inactive":true},"change_message_id":"2bdc1beb2eb5201ba7cd736162929e6b6f6188e1","unresolved":false,"context_lines":[{"line_number":81,"context_line":"                          0):"},{"line_number":82,"context_line":"            # wildcard import is not allowed as per H303"},{"line_number":83,"context_line":"            self.assertEqual(0, str.find(\u0027H303\u0027))"},{"line_number":84,"context_line":"        sys.path \u003d path"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_a4ef021d","line":84,"in_reply_to":"5a890539_5e1aafc6","updated":"2014-11-24 20:22:24.000000000","message":"Done\n\nIs there a way to use mock-decorator to do this? Looking for a suggestion.","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":6928,"name":"Ben Nemec","email":"openstack@nemebean.com","username":"bnemec"},"change_message_id":"7a4dce7e6eddab279a4034459d04eeb631fb7840","unresolved":false,"context_lines":[{"line_number":81,"context_line":"                          0):"},{"line_number":82,"context_line":"            # wildcard import is not allowed as per H303"},{"line_number":83,"context_line":"            self.assertEqual(0, str.find(\u0027H303\u0027))"},{"line_number":84,"context_line":"        sys.path \u003d path"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_fb72887a","line":84,"in_reply_to":"5a890539_a4ef021d","updated":"2014-11-24 21:58:59.000000000","message":"Yeah, looks like there is.  Try something like this:\n\n class Foo(unittest.TestCase):\n   def test_foo(self):\n      with mock.patch(\u0027sys.path\u0027, new_callable\u003dmock.PropertyMock) as sys_path:\n         sys_path.return_value \u003d \u0027.\u0027\n         print sys.path\n\nYou could do it as a decorator too, I just didn\u0027t in my example for the sake of simplicity.","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"},{"author":{"_account_id":14071,"name":"Surojit Pathak","username":"suropatz","inactive":true},"change_message_id":"2b6df90a735a020063a759b47d033c47135c8ee0","unresolved":false,"context_lines":[{"line_number":81,"context_line":"                          0):"},{"line_number":82,"context_line":"            # wildcard import is not allowed as per H303"},{"line_number":83,"context_line":"            self.assertEqual(0, str.find(\u0027H303\u0027))"},{"line_number":84,"context_line":"        sys.path \u003d path"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a890539_877a0386","line":84,"in_reply_to":"5a890539_fb72887a","updated":"2014-11-25 00:45:57.000000000","message":"Done","commit_id":"3fe71095b5172789ee45c9cc081c488f497a4797"}]}
