{"push_id":2521623651,"size":5,"distinct_size":2,"ref":"refs/heads/dont-instantiate-Client-in-tests","head":"41b359f8cc13a43eafd62544689448a5438fdcd1","before":"c6b3865cbc9feb76a8790fb16272e9e6640586ad","commits":[{"sha":"ad99475982ec64123324d4ee8630d5a172f245f2","author":{"name":"Sean Hammond","email":"46f1a0bd5592a2f9244ca321b129902a06b53e03@snhmnd.fastmail.com"},"message":"Rename OrganizationResource to OrganizationContext\n\nPart of the refactoring described in this Slack post:\n\nhttps://hypothes-is.slack.com/files/U074DEU66/FA511033L/h_traversal__resources__refactoring\n\nThis is part of renaming all the `*Resource` classes to `*Context`. In\npractice these classes are always used as \"context resources\" in Pyramid -\nthey're always the resource at the end of traversal, and passed to the\nview as the context. They're never used as intermediate resources in\ntraversal. As discussed in the Slack post, \"context\" much better\ndescribes what we're using these classes for than \"resource\".","distinct":false,"url":"https://api.github.com/repos/hypothesis/h/commits/ad99475982ec64123324d4ee8630d5a172f245f2"},{"sha":"fa9717ca2e52c04e90864d677174b09ff06a270f","author":{"name":"Sean Hammond","email":"0e4c650382b0f332954ef532789cfd678f0f8dde@users.noreply.github.com"},"message":"Remove unused add_search_matcher (#4995)\n\nRemove the unused add_search_matcher() and get_search_matchers() config\r\ndirectives.","distinct":false,"url":"https://api.github.com/repos/hypothesis/h/commits/fa9717ca2e52c04e90864d677174b09ff06a270f"},{"sha":"3b05548d01344fa03523703a6fb962d8dd30ee13","author":{"name":"Sheetal Umesh Kumar","email":"07a6e027ec1dde856548a7d66222c3694d113e37@gmail.com"},"message":"Merge pull request #4996 from hypothesis/rename-OrganizationResource-to-OrganizationContext\n\nRename OrganizationResource to OrganizationContext","distinct":false,"url":"https://api.github.com/repos/hypothesis/h/commits/3b05548d01344fa03523703a6fb962d8dd30ee13"},{"sha":"789d713679b1a3c53c516eebd731c984a11b96b5","author":{"name":"Sean Hammond","email":"46f1a0bd5592a2f9244ca321b129902a06b53e03@snhmnd.fastmail.com"},"message":"Change Client attributes into @property's\n\nChange h.search.client.Client instance variables to @property's.\n\nWhile this is a bit more verbose, it means that index and conn are now\nvisible to the mock library's create_autospec() function (mock Client\ninstances created using create_autospec() now have index and conn\nattributes, which they wouldn't before).\n\nSee:\n\nhttps://docs.python.org/3/library/unittest.mock.html#autospeccing\n\nthe paragraph beginning \"A more serious problem is that it is common for\ninstance attributes to be created in the __init__() method and not to\nexist on the class...\"\n\nThis change also clarifies the API of the class: makes it explicit that\nindex and conn are read-only.","distinct":true,"url":"https://api.github.com/repos/hypothesis/h/commits/789d713679b1a3c53c516eebd731c984a11b96b5"},{"sha":"41b359f8cc13a43eafd62544689448a5438fdcd1","author":{"name":"Sean Hammond","email":"46f1a0bd5592a2f9244ca321b129902a06b53e03@snhmnd.fastmail.com"},"message":"Don't instantiate Client instances in tests\n\nreindexer_test.py and index_test.py were instantiating\nh.search.client.Client instances in order to mock them. This confused\nme, and seems a little dodgy since instantiating a Client will\ninstantiate a real elasticsearch.Elasticsearch object (although we were\ngetting away with it).\n\nChange the tests to use create_autospec() instead, which creates mock\ninstances of classes without instantiating them.\n\nNow Client is only ever instantiated by client_test.py.","distinct":true,"url":"https://api.github.com/repos/hypothesis/h/commits/41b359f8cc13a43eafd62544689448a5438fdcd1"}]}
{"actor":{"display_login":"seanh"}}