)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"5e5f246deb857c011801d67db323760773cc1e32","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     chenke \u003cchen.ke14@zte.com.cn\u003e"},{"line_number":5,"context_line":"CommitDate: 2019-06-06 17:30:41 +0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Restore the original meaning of the code"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"In Python, when we use @property, the method will be"},{"line_number":10,"context_line":"decorated by property."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"9fb8cfa7_ae98e3bf","line":7,"updated":"2019-06-06 15:29:19.000000000","message":"nit: this title was a bit confusing until I got into the change. I suggest renaming this to something like, \"Fix property access in test_global_preference* tests\"","commit_id":"fdbfa333f63f204dc3d08b4b3c91a3cfbdbba5ce"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"fbbdac49b5bf384fe8ad3780da3f20dd3f548ac4","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     chenke \u003cchen.ke14@zte.com.cn\u003e"},{"line_number":5,"context_line":"CommitDate: 2019-06-06 17:30:41 +0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Restore the original meaning of the code"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"In Python, when we use @property, the method will be"},{"line_number":10,"context_line":"decorated by property."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"9fb8cfa7_089bc365","line":7,"in_reply_to":"9fb8cfa7_ac6a07ea","updated":"2019-06-12 16:07:04.000000000","message":"Done","commit_id":"fdbfa333f63f204dc3d08b4b3c91a3cfbdbba5ce"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"e589e4ce8b31087c56d1484c85c7d56697132aca","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     chenke \u003cchen.ke14@zte.com.cn\u003e"},{"line_number":5,"context_line":"CommitDate: 2019-06-06 17:30:41 +0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Restore the original meaning of the code"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"In Python, when we use @property, the method will be"},{"line_number":10,"context_line":"decorated by property."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"9fb8cfa7_ac6a07ea","line":7,"in_reply_to":"9fb8cfa7_ae98e3bf","updated":"2019-06-10 01:28:11.000000000","message":"Ok, thanks.","commit_id":"fdbfa333f63f204dc3d08b4b3c91a3cfbdbba5ce"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"d98ddec35b6531bef32b30270b54dfef453ecd22","unresolved":false,"context_lines":[{"line_number":14,"context_line":"1. call self.strategy.datasource_backend()"},{"line_number":15,"context_line":"2. according to  the method\u0027s return value[2], call self._datasource_backend()"},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"[1]. https://github.com/openstack/watcher/blob/master/watcher/tests/decision_engine/strategy/strategies/test_base.py#L87"},{"line_number":18,"context_line":"[2]. https://github.com/openstack/watcher/blob/master/watcher/decision_engine/strategy/strategies/base.py#L370"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"But in this part, we just want it to perform the first step."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"9fb8cfa7_4b66f953","line":17,"range":{"start_line":17,"start_character":47,"end_line":17,"end_character":53},"updated":"2019-06-06 15:16:20.000000000","message":"nit: use tags or commit hash for linking in a commit message because this line will change over time.","commit_id":"fdbfa333f63f204dc3d08b4b3c91a3cfbdbba5ce"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"e589e4ce8b31087c56d1484c85c7d56697132aca","unresolved":false,"context_lines":[{"line_number":14,"context_line":"1. call self.strategy.datasource_backend()"},{"line_number":15,"context_line":"2. according to  the method\u0027s return value[2], call self._datasource_backend()"},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"[1]. https://github.com/openstack/watcher/blob/master/watcher/tests/decision_engine/strategy/strategies/test_base.py#L87"},{"line_number":18,"context_line":"[2]. https://github.com/openstack/watcher/blob/master/watcher/decision_engine/strategy/strategies/base.py#L370"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"But in this part, we just want it to perform the first step."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"9fb8cfa7_cc6f3bfa","line":17,"range":{"start_line":17,"start_character":47,"end_line":17,"end_character":53},"in_reply_to":"9fb8cfa7_4b66f953","updated":"2019-06-10 01:28:11.000000000","message":"Ok.","commit_id":"fdbfa333f63f204dc3d08b4b3c91a3cfbdbba5ce"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"fbbdac49b5bf384fe8ad3780da3f20dd3f548ac4","unresolved":false,"context_lines":[{"line_number":14,"context_line":"1. call self.strategy.datasource_backend()"},{"line_number":15,"context_line":"2. according to  the method\u0027s return value[2], call self._datasource_backend()"},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"[1]. https://github.com/openstack/watcher/blob/master/watcher/tests/decision_engine/strategy/strategies/test_base.py#L87"},{"line_number":18,"context_line":"[2]. https://github.com/openstack/watcher/blob/master/watcher/decision_engine/strategy/strategies/base.py#L370"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"But in this part, we just want it to perform the first step."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"9fb8cfa7_a8a5d7a3","line":17,"range":{"start_line":17,"start_character":47,"end_line":17,"end_character":53},"in_reply_to":"9fb8cfa7_cc6f3bfa","updated":"2019-06-12 16:07:04.000000000","message":"Done","commit_id":"fdbfa333f63f204dc3d08b4b3c91a3cfbdbba5ce"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"d98ddec35b6531bef32b30270b54dfef453ecd22","unresolved":false,"context_lines":[{"line_number":21,"context_line":"So we have to use self.strategy.datasource_backend instead of"},{"line_number":22,"context_line":"self.strategy.datasource_backend()"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"The reason why the unittest does not report an error is"},{"line_number":25,"context_line":"because the returned value is a mock object, and the second step"},{"line_number":26,"context_line":"is executed without error, for example:"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"python -m unittest  watcher.tests.decision_engine.strategy.strategies.test_base"},{"line_number":29,"context_line":"(Pdb) x\u003dself.strategy.datasource_backend"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"9fb8cfa7_0b600132","line":26,"range":{"start_line":24,"start_character":0,"end_line":26,"end_character":39},"updated":"2019-06-06 15:16:20.000000000","message":"Thanks for explaining this. I wonder if we could use a spec on the mock to avoid it blindly generating a new mock for an invalid call?","commit_id":"fdbfa333f63f204dc3d08b4b3c91a3cfbdbba5ce"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"b133c1477d23bd3e02999e9c3009b77ee29fd913","unresolved":false,"context_lines":[{"line_number":21,"context_line":"So we have to use self.strategy.datasource_backend instead of"},{"line_number":22,"context_line":"self.strategy.datasource_backend()"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"The reason why the unittest does not report an error is"},{"line_number":25,"context_line":"because the returned value is a mock object, and the second step"},{"line_number":26,"context_line":"is executed without error, for example:"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"python -m unittest  watcher.tests.decision_engine.strategy.strategies.test_base"},{"line_number":29,"context_line":"(Pdb) x\u003dself.strategy.datasource_backend"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"9fb8cfa7_4e7a8788","line":26,"range":{"start_line":24,"start_character":0,"end_line":26,"end_character":39},"in_reply_to":"9fb8cfa7_0b600132","updated":"2019-06-06 15:27:27.000000000","message":"This makes the test fail in it\u0027s current form so I think we should add that as well to essentially poison anything calling the returned database_backend in these tests to enforce the property is accessed correctly:\n\nosboxes@osboxes:~/git/watcher$ git diff\ndiff --git a/watcher/tests/decision_engine/strategy/strategies/test_base.py b/watcher/tests/decision_engine/strategy/strategies/test_base.py\nindex b6e0bfe2..32427eaf 100644\n--- a/watcher/tests/decision_engine/strategy/strategies/test_base.py\n+++ b/watcher/tests/decision_engine/strategy/strategies/test_base.py\n@@ -82,6 +82,9 @@ class TestBaseStrategyDatasource(TestBaseStrategy):\n         m_conf.watcher_datasources.datasources \u003d \\\n             [\u0027ceilometer\u0027, \u0027monasca\u0027, \u0027gnocchi\u0027]\n \n+        m_manager.return_value.get_backend.return_value \u003d \\\n+            mock.NonCallableMock()\n+\n         # Access the property so that the configuration is read in order to\n         # get the correct datasource\n         self.strategy.datasource_backend()\nosboxes@osboxes:~/git/watcher$","commit_id":"fdbfa333f63f204dc3d08b4b3c91a3cfbdbba5ce"},{"author":{"_account_id":28748,"name":"chenker","email":"chen.ke14@zte.com.cn","username":"chenke"},"change_message_id":"e589e4ce8b31087c56d1484c85c7d56697132aca","unresolved":false,"context_lines":[{"line_number":21,"context_line":"So we have to use self.strategy.datasource_backend instead of"},{"line_number":22,"context_line":"self.strategy.datasource_backend()"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"The reason why the unittest does not report an error is"},{"line_number":25,"context_line":"because the returned value is a mock object, and the second step"},{"line_number":26,"context_line":"is executed without error, for example:"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"python -m unittest  watcher.tests.decision_engine.strategy.strategies.test_base"},{"line_number":29,"context_line":"(Pdb) x\u003dself.strategy.datasource_backend"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"9fb8cfa7_6c788fc3","line":26,"range":{"start_line":24,"start_character":0,"end_line":26,"end_character":39},"in_reply_to":"9fb8cfa7_4e7a8788","updated":"2019-06-10 01:28:11.000000000","message":"Ok, i will try this.","commit_id":"fdbfa333f63f204dc3d08b4b3c91a3cfbdbba5ce"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"fbbdac49b5bf384fe8ad3780da3f20dd3f548ac4","unresolved":false,"context_lines":[{"line_number":21,"context_line":"So we have to use self.strategy.datasource_backend instead of"},{"line_number":22,"context_line":"self.strategy.datasource_backend()"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"The reason why the unittest does not report an error is"},{"line_number":25,"context_line":"because the returned value is a mock object, and the second step"},{"line_number":26,"context_line":"is executed without error, for example:"},{"line_number":27,"context_line":""},{"line_number":28,"context_line":"python -m unittest  watcher.tests.decision_engine.strategy.strategies.test_base"},{"line_number":29,"context_line":"(Pdb) x\u003dself.strategy.datasource_backend"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"9fb8cfa7_e8b0afdf","line":26,"range":{"start_line":24,"start_character":0,"end_line":26,"end_character":39},"in_reply_to":"9fb8cfa7_6c788fc3","updated":"2019-06-12 16:07:04.000000000","message":"Done","commit_id":"fdbfa333f63f204dc3d08b4b3c91a3cfbdbba5ce"}]}
