{"action":"created","issue":{"url":"https://api.github.com/repos/twisted/treq/issues/106","labels_url":"https://api.github.com/repos/twisted/treq/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/twisted/treq/issues/106/comments","events_url":"https://api.github.com/repos/twisted/treq/issues/106/events","html_url":"https://github.com/twisted/treq/pull/106","id":94836702,"number":106,"title":"Utility for providing a sequence of requests/responses to StubTreq","user":{"login":"cyli","id":223200,"avatar_url":"https://avatars.githubusercontent.com/u/223200?v=3","gravatar_id":"","url":"https://api.github.com/users/cyli","html_url":"https://github.com/cyli","followers_url":"https://api.github.com/users/cyli/followers","following_url":"https://api.github.com/users/cyli/following{/other_user}","gists_url":"https://api.github.com/users/cyli/gists{/gist_id}","starred_url":"https://api.github.com/users/cyli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cyli/subscriptions","organizations_url":"https://api.github.com/users/cyli/orgs","repos_url":"https://api.github.com/users/cyli/repos","events_url":"https://api.github.com/users/cyli/events{/privacy}","received_events_url":"https://api.github.com/users/cyli/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-07-13T23:49:43Z","updated_at":"2015-07-14T05:33:52Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/twisted/treq/pulls/106","html_url":"https://github.com/twisted/treq/pull/106","diff_url":"https://github.com/twisted/treq/pull/106.diff","patch_url":"https://github.com/twisted/treq/pull/106.patch"},"body":"This was originally in #96, and removed to make review easier.  This undoes that remove.\r\n\r\nPart of addressing #27.\r\n\r\nAgain, planning on writing docs in another PR, as this PR is fairly large already and may get slightly larger depending on review comments."},"comment":{"url":"https://api.github.com/repos/twisted/treq/issues/comments/121136516","html_url":"https://github.com/twisted/treq/pull/106#issuecomment-121136516","issue_url":"https://api.github.com/repos/twisted/treq/issues/106","id":121136516,"user":{"login":"glyph","id":716529,"avatar_url":"https://avatars.githubusercontent.com/u/716529?v=3","gravatar_id":"","url":"https://api.github.com/users/glyph","html_url":"https://github.com/glyph","followers_url":"https://api.github.com/users/glyph/followers","following_url":"https://api.github.com/users/glyph/following{/other_user}","gists_url":"https://api.github.com/users/glyph/gists{/gist_id}","starred_url":"https://api.github.com/users/glyph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glyph/subscriptions","organizations_url":"https://api.github.com/users/glyph/orgs","repos_url":"https://api.github.com/users/glyph/repos","events_url":"https://api.github.com/users/glyph/events{/privacy}","received_events_url":"https://api.github.com/users/glyph/received_events","type":"User","site_admin":false},"created_at":"2015-07-14T05:33:52Z","updated_at":"2015-07-14T05:33:52Z","body":"> 2.  I'm not super happy about storing the failures and having to test that, but I don't think there's any other way, since `Resource.render` will eat any other exception and just return a 500, and getting around that is pretty hard.  Any suggestions?\r\n\r\nI think that burdening the caller with performing this check themselves every time is indeed the wrong thing to do: anywhere you say \"and then the caller must...\" is an opportunity for a mistake to be made.\r\n\r\nWhat do you think of this, instead: require a `TestCase` as an argument to `StringStubbingResource`, and then instead of doing `self.test_case.fail(...)`, do `self.test_case.addCleanup(lambda: self.test_case.fail)`?  This puts the test failure in a context that reports directly to `TestCase` and doesn't get caught by intermediary resource-rendering code.\r\n\r\nYou can pass the `TestCase` along either to `StringStubbingResource` or to `SequenceStringStubs`.  In either case you should be able to eliminate the `failures` list; if you pass it to `StringStubbingResource` you can get rid of it entirely, if you pass it to `SequenceStringStubs`, you can replace it with a simpler `addFailure` reporting protocol; no need to couple to all the methods of `list` in the interface."}}