)]}'
{"swift/cli/ringbuilder.py":[{"author":{"_account_id":597,"name":"Pete Zaitcev","email":"zaitcev@kotori.zaitcev.us","username":"zaitcev"},"change_message_id":"b47aefcae83e64f4297aa89411a1ad6cc4654266","unresolved":false,"context_lines":[{"line_number":843,"context_line":"                msg \u003d \u0027Ring Builder file cannot be accessed\u0027"},{"line_number":844,"context_line":"            print \u0027%s: %s\u0027 % (msg, argv[1])"},{"line_number":845,"context_line":"            exit(EXIT_ERROR)"},{"line_number":846,"context_line":"    except Exception:"},{"line_number":847,"context_line":"        print \u0027Problem occurred while reading builder file: %s\u0027 % argv[1]"},{"line_number":848,"context_line":"        exit(EXIT_ERROR)"},{"line_number":849,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"da9df570_4a4a6581","line":846,"updated":"2014-09-23 04:22:34.000000000","message":"Is this really necessary to catch Exception, if you plugged the known exceptions? I know that tracebacks are ugly but sometimes they\u0027re essential.","commit_id":"0d605b6c4f219b7797fa2514f69fdc3a1934056e"},{"author":{"_account_id":9051,"name":"Keshava Bharadwaj","email":"kb.sankethi@gmail.com","username":"keshava"},"change_message_id":"b9ca6288b3c75228a0473642535fb7c5f8ee8d60","unresolved":false,"context_lines":[{"line_number":843,"context_line":"                msg \u003d \u0027Ring Builder file cannot be accessed\u0027"},{"line_number":844,"context_line":"            print \u0027%s: %s\u0027 % (msg, argv[1])"},{"line_number":845,"context_line":"            exit(EXIT_ERROR)"},{"line_number":846,"context_line":"    except Exception:"},{"line_number":847,"context_line":"        print \u0027Problem occurred while reading builder file: %s\u0027 % argv[1]"},{"line_number":848,"context_line":"        exit(EXIT_ERROR)"},{"line_number":849,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"da9df570_b51a5615","line":846,"in_reply_to":"da9df570_4a4a6581","updated":"2014-09-23 04:49:51.000000000","message":"Yes.. Its essential. It\u0027ll catch the errors.. and say nunknown probelm.\nYou can\u0027t throw nasty exception to user just like that. a meaningful message needs to be displayed.","commit_id":"0d605b6c4f219b7797fa2514f69fdc3a1934056e"},{"author":{"_account_id":597,"name":"Pete Zaitcev","email":"zaitcev@kotori.zaitcev.us","username":"zaitcev"},"change_message_id":"b47aefcae83e64f4297aa89411a1ad6cc4654266","unresolved":false,"context_lines":[{"line_number":844,"context_line":"            print \u0027%s: %s\u0027 % (msg, argv[1])"},{"line_number":845,"context_line":"            exit(EXIT_ERROR)"},{"line_number":846,"context_line":"    except Exception:"},{"line_number":847,"context_line":"        print \u0027Problem occurred while reading builder file: %s\u0027 % argv[1]"},{"line_number":848,"context_line":"        exit(EXIT_ERROR)"},{"line_number":849,"context_line":""},{"line_number":850,"context_line":"    backup_dir \u003d pathjoin(dirname(argv[1]), \u0027backups\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"da9df570_0a1e9d70","line":847,"updated":"2014-09-23 04:22:34.000000000","message":"I am against the blank Exception in general, so this statement is probably unnecessary, but if you insist please print \"%s\"%e. A blind \"Problem occured\" with no indication of the nature of the problem is not acceptable.","commit_id":"0d605b6c4f219b7797fa2514f69fdc3a1934056e"},{"author":{"_account_id":9051,"name":"Keshava Bharadwaj","email":"kb.sankethi@gmail.com","username":"keshava"},"change_message_id":"e6319de9f3a1fd4a91ac2217d26f69137bbad0e5","unresolved":false,"context_lines":[{"line_number":844,"context_line":"            print \u0027%s: %s\u0027 % (msg, argv[1])"},{"line_number":845,"context_line":"            exit(EXIT_ERROR)"},{"line_number":846,"context_line":"    except Exception:"},{"line_number":847,"context_line":"        print \u0027Problem occurred while reading builder file: %s\u0027 % argv[1]"},{"line_number":848,"context_line":"        exit(EXIT_ERROR)"},{"line_number":849,"context_line":""},{"line_number":850,"context_line":"    backup_dir \u003d pathjoin(dirname(argv[1]), \u0027backups\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"da9df570_464c0b71","line":847,"in_reply_to":"da9df570_0a1e9d70","updated":"2014-09-23 17:24:48.000000000","message":"Agree.. added that extra stack trace for debugging.","commit_id":"0d605b6c4f219b7797fa2514f69fdc3a1934056e"},{"author":{"_account_id":9051,"name":"Keshava Bharadwaj","email":"kb.sankethi@gmail.com","username":"keshava"},"change_message_id":"b9ca6288b3c75228a0473642535fb7c5f8ee8d60","unresolved":false,"context_lines":[{"line_number":844,"context_line":"            print \u0027%s: %s\u0027 % (msg, argv[1])"},{"line_number":845,"context_line":"            exit(EXIT_ERROR)"},{"line_number":846,"context_line":"    except Exception:"},{"line_number":847,"context_line":"        print \u0027Problem occurred while reading builder file: %s\u0027 % argv[1]"},{"line_number":848,"context_line":"        exit(EXIT_ERROR)"},{"line_number":849,"context_line":""},{"line_number":850,"context_line":"    backup_dir \u003d pathjoin(dirname(argv[1]), \u0027backups\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"da9df570_95e4720e","line":847,"in_reply_to":"da9df570_0a1e9d70","updated":"2014-09-23 04:49:51.000000000","message":"The whole premise of this code block is reading a builder file. and if all errors are covered and unknown error occurs, it makes sense to say, problem occurred while reading builder file. throwing exception stacktrace to a user is a bad idea","commit_id":"0d605b6c4f219b7797fa2514f69fdc3a1934056e"},{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"9ca8b70982463cbac2cf1b34c5212fe77ba6bb3e","unresolved":false,"context_lines":[{"line_number":842,"context_line":"            elif isinstance(e, exceptions.PermissionError):"},{"line_number":843,"context_line":"                msg \u003d \u0027Ring Builder file cannot be accessed\u0027"},{"line_number":844,"context_line":"            print \u0027%s: %s\u0027 % (msg, argv[1])"},{"line_number":845,"context_line":"            exit(EXIT_ERROR)"},{"line_number":846,"context_line":"    except Exception as e:"},{"line_number":847,"context_line":"        print \u0027Problem occurred while reading builder file: %s. %s\u0027 % ("},{"line_number":848,"context_line":"            argv[1], e.message)"}],"source_content_type":"text/x-python","patch_set":5,"id":"da9df570_889b3571","line":845,"updated":"2014-09-25 01:34:22.000000000","message":"If you pass the message from the code raising these exceptions then the code will be much simpler, rather then throwing dependently and then catching and dealing independently (With extra if statements). Rather you could raise with the message and then:\n\n  except (exceptions.UnPicklingError, exceptions.FileNotFoundError,\n          exceptions.PermissionsError) as e:\n      print e\n      exit(EXIT_ERROR)\n  except Exception as e:\n      ...\n\nOr I guess expand out the so you can have the if statement:\n\n  except exceptions.UnPicklingError as e:\n      print e\n      exit(EXIT_ERROR)\n  except (exceptions.FileNotFoundError, exceptions.PermissionsError) as e:\n      if len(argv) \u003c 3 or argv[2] not in(\u0027create\u0027, \u0027write_builder\u0027):\n          print e\n          exit(EXIT_ERROR)\n  except Exception as e:\n      ...","commit_id":"848219591ff062a07193bb73455259a0d713b2fb"},{"author":{"_account_id":9051,"name":"Keshava Bharadwaj","email":"kb.sankethi@gmail.com","username":"keshava"},"change_message_id":"fe2d8e0eb4e1a9708955339e0d2b0363f43679ff","unresolved":false,"context_lines":[{"line_number":842,"context_line":"            elif isinstance(e, exceptions.PermissionError):"},{"line_number":843,"context_line":"                msg \u003d \u0027Ring Builder file cannot be accessed\u0027"},{"line_number":844,"context_line":"            print \u0027%s: %s\u0027 % (msg, argv[1])"},{"line_number":845,"context_line":"            exit(EXIT_ERROR)"},{"line_number":846,"context_line":"    except Exception as e:"},{"line_number":847,"context_line":"        print \u0027Problem occurred while reading builder file: %s. %s\u0027 % ("},{"line_number":848,"context_line":"            argv[1], e.message)"}],"source_content_type":"text/x-python","patch_set":5,"id":"da9df570_2d5c08ed","line":845,"in_reply_to":"da9df570_889b3571","updated":"2014-09-25 14:32:01.000000000","message":"Done","commit_id":"848219591ff062a07193bb73455259a0d713b2fb"}],"swift/common/ring/builder.py":[{"author":{"_account_id":2622,"name":"Samuel Merritt","email":"spam+launchpad@andcheese.org","username":"torgomatic"},"change_message_id":"79c902ffb51a1fedd5c45025a72d9c142bc8d9b2","unresolved":false,"context_lines":[{"line_number":1037,"context_line":"        :return: RingBuilder instance"},{"line_number":1038,"context_line":"        \"\"\""},{"line_number":1039,"context_line":"        try:"},{"line_number":1040,"context_line":"            builder \u003d pickle.load(open(builder_file, \u0027rb\u0027))"},{"line_number":1041,"context_line":"        except Exception as e:"},{"line_number":1042,"context_line":"            # raise error during unpickling as UnPicklingError"},{"line_number":1043,"context_line":"            # pickle.load can also raise other errors and these are"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa98f980_e29a646d","line":1040,"updated":"2014-09-17 19:32:02.000000000","message":"can we keep the open() out of here? translating whatever wacky errors pickle throws is fine, but no-such-file or permission-denied shouldn\u0027t be turned into unpickling errors IMO","commit_id":"57bbbd81299157d1a243fee158f1d772900dea14"},{"author":{"_account_id":2622,"name":"Samuel Merritt","email":"spam+launchpad@andcheese.org","username":"torgomatic"},"change_message_id":"d073d87d139a139171ba7230dbfa7ce562e0698b","unresolved":false,"context_lines":[{"line_number":1037,"context_line":"        :return: RingBuilder instance"},{"line_number":1038,"context_line":"        \"\"\""},{"line_number":1039,"context_line":"        try:"},{"line_number":1040,"context_line":"            builder \u003d pickle.load(open(builder_file, \u0027rb\u0027))"},{"line_number":1041,"context_line":"        except Exception as e:"},{"line_number":1042,"context_line":"            # raise error during unpickling as UnPicklingError"},{"line_number":1043,"context_line":"            # pickle.load can also raise other errors and these are"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa98f980_e2f7c457","line":1040,"in_reply_to":"fa98f980_4234104a","updated":"2014-09-17 19:47:26.000000000","message":"I\u0027d still like to keep them separate because they have separate fixes from the operator standpoint.\n\nOSError/ENOENT? Fix my mistyped filename.\n\nOSError/EPERM? chmod or sudo.\n\nValueError or EOFError from pickle.load()? Builder\u0027s corrupt; go get a backup.\n\nBasically, the common mistakes should have their own handling; I certainly mistype filenames all the time, and I also forget to sudo all the time. I don\u0027t want an error message to send me digging around in my builder backups when really I just forgot to cd into the right directory or something.","commit_id":"57bbbd81299157d1a243fee158f1d772900dea14"},{"author":{"_account_id":2622,"name":"Samuel Merritt","email":"spam+launchpad@andcheese.org","username":"torgomatic"},"change_message_id":"7773076545fe260466e8fab067038a0f4db53917","unresolved":false,"context_lines":[{"line_number":1037,"context_line":"        :return: RingBuilder instance"},{"line_number":1038,"context_line":"        \"\"\""},{"line_number":1039,"context_line":"        try:"},{"line_number":1040,"context_line":"            builder \u003d pickle.load(open(builder_file, \u0027rb\u0027))"},{"line_number":1041,"context_line":"        except Exception as e:"},{"line_number":1042,"context_line":"            # raise error during unpickling as UnPicklingError"},{"line_number":1043,"context_line":"            # pickle.load can also raise other errors and these are"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa98f980_16e16ad0","line":1040,"in_reply_to":"fa98f980_457b3a7b","updated":"2014-09-17 22:55:56.000000000","message":"I think the two that deserve special handling are ENOENT and EPERM. I\u0027m okay with everything else being under some other exception class.","commit_id":"57bbbd81299157d1a243fee158f1d772900dea14"},{"author":{"_account_id":9051,"name":"Keshava Bharadwaj","email":"kb.sankethi@gmail.com","username":"keshava"},"change_message_id":"58dd8de3ab1d494ce9f41692941f589303854b8f","unresolved":false,"context_lines":[{"line_number":1037,"context_line":"        :return: RingBuilder instance"},{"line_number":1038,"context_line":"        \"\"\""},{"line_number":1039,"context_line":"        try:"},{"line_number":1040,"context_line":"            builder \u003d pickle.load(open(builder_file, \u0027rb\u0027))"},{"line_number":1041,"context_line":"        except Exception as e:"},{"line_number":1042,"context_line":"            # raise error during unpickling as UnPicklingError"},{"line_number":1043,"context_line":"            # pickle.load can also raise other errors and these are"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa98f980_4234104a","line":1040,"in_reply_to":"fa98f980_e29a646d","updated":"2014-09-17 19:39:55.000000000","message":"Thnx for  reviewing. Correct. Agree. I thought about it. In this context, if a file fails to load ( whether permission issue, unpickling error , EOF error, attribute error) , everything is captured generic as Unpickling Error. Other wise we would have at least 10 exceptions we can catch straight away and provide 10 appropriate error messages for the same which i thought would be an overload. \n\nIf the exception UnpicklingError is misleading, can i rename it to something like\nBuilderReadError ? does it make sense ?","commit_id":"57bbbd81299157d1a243fee158f1d772900dea14"},{"author":{"_account_id":9051,"name":"Keshava Bharadwaj","email":"kb.sankethi@gmail.com","username":"keshava"},"change_message_id":"da1217eb88e1353e069cbc51c37529629cae610b","unresolved":false,"context_lines":[{"line_number":1037,"context_line":"        :return: RingBuilder instance"},{"line_number":1038,"context_line":"        \"\"\""},{"line_number":1039,"context_line":"        try:"},{"line_number":1040,"context_line":"            builder \u003d pickle.load(open(builder_file, \u0027rb\u0027))"},{"line_number":1041,"context_line":"        except Exception as e:"},{"line_number":1042,"context_line":"            # raise error during unpickling as UnPicklingError"},{"line_number":1043,"context_line":"            # pickle.load can also raise other errors and these are"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa98f980_457b3a7b","line":1040,"in_reply_to":"fa98f980_e2f7c457","updated":"2014-09-17 20:02:34.000000000","message":"ring.builder.load is called from cli.ringbuilder. and prior to calling it, it does\n\nif exists(builder_file):. \nSo, OSError/ENOENT? Fix my mistyped filename \nis taken care.\n\nSo, the load is called only for a *existing builder file*. In this case, doesn\u0027t throwing a BuilderReadError makes sense for file which could not be loaded for any reason? \nI believe this is better than the earlier case of not having catching the exception at all and throwing the stack trace.\n\nOr if you want individualized exception handling, can you pls let know the list of error messages/cases that needs to be handled in your opinion. this would help since there can be umpteen reasons this can go wrong, and having a case for all those reasons seems difficult.","commit_id":"57bbbd81299157d1a243fee158f1d772900dea14"},{"author":{"_account_id":597,"name":"Pete Zaitcev","email":"zaitcev@kotori.zaitcev.us","username":"zaitcev"},"change_message_id":"b47aefcae83e64f4297aa89411a1ad6cc4654266","unresolved":false,"context_lines":[{"line_number":1050,"context_line":"            with fp:"},{"line_number":1051,"context_line":"                try:"},{"line_number":1052,"context_line":"                    builder \u003d pickle.load(fp)"},{"line_number":1053,"context_line":"                except Exception:"},{"line_number":1054,"context_line":"                    # raise error during unpickling as UnPicklingError"},{"line_number":1055,"context_line":"                    raise exceptions.UnPicklingError()"},{"line_number":1056,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"da9df570_1505e210","line":1053,"updated":"2014-09-23 04:22:34.000000000","message":"I\u0027m against this. At least catch ValueError or something.","commit_id":"0d605b6c4f219b7797fa2514f69fdc3a1934056e"},{"author":{"_account_id":9051,"name":"Keshava Bharadwaj","email":"kb.sankethi@gmail.com","username":"keshava"},"change_message_id":"b9ca6288b3c75228a0473642535fb7c5f8ee8d60","unresolved":false,"context_lines":[{"line_number":1050,"context_line":"            with fp:"},{"line_number":1051,"context_line":"                try:"},{"line_number":1052,"context_line":"                    builder \u003d pickle.load(fp)"},{"line_number":1053,"context_line":"                except Exception:"},{"line_number":1054,"context_line":"                    # raise error during unpickling as UnPicklingError"},{"line_number":1055,"context_line":"                    raise exceptions.UnPicklingError()"},{"line_number":1056,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"da9df570_35b586ee","line":1053,"in_reply_to":"da9df570_1505e210","updated":"2014-09-23 04:49:51.000000000","message":"All exceptions are culmulatively collected as unpickling error, since we are interested in unpickling the object","commit_id":"0d605b6c4f219b7797fa2514f69fdc3a1934056e"},{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"9ca8b70982463cbac2cf1b34c5212fe77ba6bb3e","unresolved":false,"context_lines":[{"line_number":1052,"context_line":"                    builder \u003d pickle.load(fp)"},{"line_number":1053,"context_line":"                except Exception:"},{"line_number":1054,"context_line":"                    # raise error during unpickling as UnPicklingError"},{"line_number":1055,"context_line":"                    raise exceptions.UnPicklingError()"},{"line_number":1056,"context_line":""},{"line_number":1057,"context_line":"        if not hasattr(builder, \u0027devs\u0027):"},{"line_number":1058,"context_line":"            builder_dict \u003d builder"}],"source_content_type":"text/x-python","patch_set":5,"id":"da9df570_08ed858b","line":1055,"updated":"2014-09-25 01:34:22.000000000","message":"For the three Exceptions your raising, you could pass the message when you build them, ie: \n\n  raise exceptions.FileNotFoundError(\u0027Ring Builder file does not exist: %s\u0027 % (builder_file))\n  ...\n  raise exceptions.PermissionError(\u0027Ring Builder file cannot be accessed: %s\u0027 % (builder_file))\n  ...\n  raise exceptions.UnPicklingError(\u0027Ring Builder file is invalid: %s\u0027 % (builder_file))\n\nThis will make the catching code alot easier.","commit_id":"848219591ff062a07193bb73455259a0d713b2fb"},{"author":{"_account_id":9051,"name":"Keshava Bharadwaj","email":"kb.sankethi@gmail.com","username":"keshava"},"change_message_id":"fe2d8e0eb4e1a9708955339e0d2b0363f43679ff","unresolved":false,"context_lines":[{"line_number":1052,"context_line":"                    builder \u003d pickle.load(fp)"},{"line_number":1053,"context_line":"                except Exception:"},{"line_number":1054,"context_line":"                    # raise error during unpickling as UnPicklingError"},{"line_number":1055,"context_line":"                    raise exceptions.UnPicklingError()"},{"line_number":1056,"context_line":""},{"line_number":1057,"context_line":"        if not hasattr(builder, \u0027devs\u0027):"},{"line_number":1058,"context_line":"            builder_dict \u003d builder"}],"source_content_type":"text/x-python","patch_set":5,"id":"da9df570_4d74ec67","line":1055,"in_reply_to":"da9df570_08ed858b","updated":"2014-09-25 14:32:01.000000000","message":"Done","commit_id":"848219591ff062a07193bb73455259a0d713b2fb"}],"test/unit/cli/test_ringbuilder.py":[{"author":{"_account_id":2622,"name":"Samuel Merritt","email":"spam+launchpad@andcheese.org","username":"torgomatic"},"change_message_id":"05f259cefa0805ac23a5874b658f40fed135ad96","unresolved":false,"context_lines":[{"line_number":218,"context_line":"        except SystemExit as e:"},{"line_number":219,"context_line":"            self.assertEquals(e.code, 2)"},{"line_number":220,"context_line":"        except Exception:"},{"line_number":221,"context_line":"            self.fail(\u0027Unexepected exception\u0027)"},{"line_number":222,"context_line":""},{"line_number":223,"context_line":"    def test_validate_corrupted_file(self):"},{"line_number":224,"context_line":"        self.create_sample_ring()"}],"source_content_type":"text/x-python","patch_set":3,"id":"fa98f980_552d85fc","line":221,"updated":"2014-09-19 01:31:24.000000000","message":"I\u0027d prefer not to have the \"except Exception:\" block on this test, or any of them. If an exception is going to make a test fail, just let it go through and fail instead of throwing away the type, message,  line number, and stack trace.\n\nBasically, next time I\u0027m editing the ring builder and I make a stupid typo and get a NameError, I want to see NameError in my test output so I can go fix my mistake.","commit_id":"5ccb329083af85ea1a1da45a9f4f6c7fa650c951"},{"author":{"_account_id":9051,"name":"Keshava Bharadwaj","email":"kb.sankethi@gmail.com","username":"keshava"},"change_message_id":"8db63c63747ace1a67902e640fd6dbe0a1c08514","unresolved":false,"context_lines":[{"line_number":218,"context_line":"        except SystemExit as e:"},{"line_number":219,"context_line":"            self.assertEquals(e.code, 2)"},{"line_number":220,"context_line":"        except Exception:"},{"line_number":221,"context_line":"            self.fail(\u0027Unexepected exception\u0027)"},{"line_number":222,"context_line":""},{"line_number":223,"context_line":"    def test_validate_corrupted_file(self):"},{"line_number":224,"context_line":"        self.create_sample_ring()"}],"source_content_type":"text/x-python","patch_set":3,"id":"fa98f980_f375b1fa","line":221,"in_reply_to":"fa98f980_552d85fc","updated":"2014-09-19 04:16:25.000000000","message":"Done","commit_id":"5ccb329083af85ea1a1da45a9f4f6c7fa650c951"},{"author":{"_account_id":2622,"name":"Samuel Merritt","email":"spam+launchpad@andcheese.org","username":"torgomatic"},"change_message_id":"05f259cefa0805ac23a5874b658f40fed135ad96","unresolved":false,"context_lines":[{"line_number":250,"context_line":""},{"line_number":251,"context_line":"    def test_validate_non_accessible_file(self):"},{"line_number":252,"context_line":"        restore \u003d RingBuilder.load"},{"line_number":253,"context_line":"        RingBuilder.load \u003d mock.Mock(side_effect\u003dexceptions.PermissionError)"},{"line_number":254,"context_line":"        argv \u003d [\"\", self.tmpfile, \"validate\"]"},{"line_number":255,"context_line":"        try:"},{"line_number":256,"context_line":"            swift.cli.ringbuilder.main(argv)"}],"source_content_type":"text/x-python","patch_set":3,"id":"fa98f980_7534494a","line":253,"updated":"2014-09-19 01:31:24.000000000","message":"You can use mock.patch.object to get this behavior without the restore boilerplate:\n\n    with mock.patch.object(RingBuilder, \u0027load\u0027, Mock(side_effect\u003dexceptions.PermissionError)):\n        try:\n            swift.cli.ringbuilder.main(...)","commit_id":"5ccb329083af85ea1a1da45a9f4f6c7fa650c951"},{"author":{"_account_id":9051,"name":"Keshava Bharadwaj","email":"kb.sankethi@gmail.com","username":"keshava"},"change_message_id":"8db63c63747ace1a67902e640fd6dbe0a1c08514","unresolved":false,"context_lines":[{"line_number":250,"context_line":""},{"line_number":251,"context_line":"    def test_validate_non_accessible_file(self):"},{"line_number":252,"context_line":"        restore \u003d RingBuilder.load"},{"line_number":253,"context_line":"        RingBuilder.load \u003d mock.Mock(side_effect\u003dexceptions.PermissionError)"},{"line_number":254,"context_line":"        argv \u003d [\"\", self.tmpfile, \"validate\"]"},{"line_number":255,"context_line":"        try:"},{"line_number":256,"context_line":"            swift.cli.ringbuilder.main(argv)"}],"source_content_type":"text/x-python","patch_set":3,"id":"fa98f980_335f3977","line":253,"in_reply_to":"fa98f980_7534494a","updated":"2014-09-19 04:16:25.000000000","message":"Thanks for letting me know. this is a much better way.","commit_id":"5ccb329083af85ea1a1da45a9f4f6c7fa650c951"}],"test/unit/common/ring/test_builder.py":[{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"9ca8b70982463cbac2cf1b34c5212fe77ba6bb3e","unresolved":false,"context_lines":[{"line_number":913,"context_line":"            self.assertEquals(builder.devs, rb.devs)"},{"line_number":914,"context_line":""},{"line_number":915,"context_line":"            #test an empty builder"},{"line_number":916,"context_line":"            fake_pickle \u003d mock.Mock(side_effect\u003dEOFError)"},{"line_number":917,"context_line":"            pickle.load \u003d fake_pickle"},{"line_number":918,"context_line":"            self.assertRaises(exceptions.UnPicklingError,"},{"line_number":919,"context_line":"                              ring.RingBuilder.load, \u0027fake.builder\u0027,"}],"source_content_type":"text/x-python","patch_set":5,"id":"da9df570_1ff93c80","line":916,"updated":"2014-09-25 01:34:22.000000000","message":"fake_pickle already exists and being reused over and over again, you can reuse it too rather then recreating it on each of your tests:\n\n  fake_pickle.side_effect \u003d EOFError\n\nThe same can be said of fake_open:\n\n  fake_open.side_effect \u003d io_error_not_found","commit_id":"848219591ff062a07193bb73455259a0d713b2fb"},{"author":{"_account_id":9051,"name":"Keshava Bharadwaj","email":"kb.sankethi@gmail.com","username":"keshava"},"change_message_id":"fe2d8e0eb4e1a9708955339e0d2b0363f43679ff","unresolved":false,"context_lines":[{"line_number":913,"context_line":"            self.assertEquals(builder.devs, rb.devs)"},{"line_number":914,"context_line":""},{"line_number":915,"context_line":"            #test an empty builder"},{"line_number":916,"context_line":"            fake_pickle \u003d mock.Mock(side_effect\u003dEOFError)"},{"line_number":917,"context_line":"            pickle.load \u003d fake_pickle"},{"line_number":918,"context_line":"            self.assertRaises(exceptions.UnPicklingError,"},{"line_number":919,"context_line":"                              ring.RingBuilder.load, \u0027fake.builder\u0027,"}],"source_content_type":"text/x-python","patch_set":5,"id":"da9df570_6d71b075","line":916,"in_reply_to":"da9df570_1ff93c80","updated":"2014-09-25 14:32:01.000000000","message":"Done","commit_id":"848219591ff062a07193bb73455259a0d713b2fb"},{"author":{"_account_id":7233,"name":"Matthew Oliver","email":"matt@oliver.net.au","username":"mattoliverau"},"change_message_id":"9ca8b70982463cbac2cf1b34c5212fe77ba6bb3e","unresolved":false,"context_lines":[{"line_number":932,"context_line":"            self.assertRaises(exceptions.UnPicklingError,"},{"line_number":933,"context_line":"                              ring.RingBuilder.load, \u0027fake.builder\u0027,"},{"line_number":934,"context_line":"                              open\u003dfake_open)"},{"line_number":935,"context_line":""},{"line_number":936,"context_line":"            #test non existent builder file"},{"line_number":937,"context_line":"            fake_open \u003d mock.Mock(side_effect\u003dio_error_not_found)"},{"line_number":938,"context_line":"            self.assertRaises(exceptions.FileNotFoundError,"}],"source_content_type":"text/x-python","patch_set":5,"id":"da9df570_1fc5bc8d","line":935,"updated":"2014-09-25 01:34:22.000000000","message":"Now that you have stopped overloading (mocking pickle.load) and moving onto fake_open. pickle.open should really be reverted in case it is confusing your tests.. I\u0027m not saying it is, but we need to be sure we are testing as much of the real code as possible.\n\nYou should move your fake_open tests (below) to outside the try/finally which is being used to mock and then revert pickle.open.","commit_id":"848219591ff062a07193bb73455259a0d713b2fb"},{"author":{"_account_id":9051,"name":"Keshava Bharadwaj","email":"kb.sankethi@gmail.com","username":"keshava"},"change_message_id":"fe2d8e0eb4e1a9708955339e0d2b0363f43679ff","unresolved":false,"context_lines":[{"line_number":932,"context_line":"            self.assertRaises(exceptions.UnPicklingError,"},{"line_number":933,"context_line":"                              ring.RingBuilder.load, \u0027fake.builder\u0027,"},{"line_number":934,"context_line":"                              open\u003dfake_open)"},{"line_number":935,"context_line":""},{"line_number":936,"context_line":"            #test non existent builder file"},{"line_number":937,"context_line":"            fake_open \u003d mock.Mock(side_effect\u003dio_error_not_found)"},{"line_number":938,"context_line":"            self.assertRaises(exceptions.FileNotFoundError,"}],"source_content_type":"text/x-python","patch_set":5,"id":"da9df570_8d6a547f","line":935,"in_reply_to":"da9df570_1fc5bc8d","updated":"2014-09-25 14:32:01.000000000","message":"Done","commit_id":"848219591ff062a07193bb73455259a0d713b2fb"}]}
