{"action":"created","comment":{"url":"https://api.github.com/repos/praekelt/vumi/pulls/comments/33337029","id":33337029,"diff_hunk":"@@ -169,6 +171,43 @@ def get_timeout():\n     return float(timeout_str)\n \n \n+def get_stack_trace(exclude_last=0):\n+    \"\"\"\n+    Get a stack trace that can be stored and referred to later.\n+\n+    The inside of this function is excluded from the stack trace, because it's\n+    not relevant. Additionally, all entries prior to the first occurrence of\n+    \"twisted/trial/_asynctest.py\" or \"django/test/testcases.py\" are removed to\n+    avoid unnecessary test runner noise.\n+\n+    :param int exclude_last:\n+        Number of entries to remove from the end of the stack trace. Use this\n+        to get rid of wrapper functions or implementation details irrelevant to\n+        the purpose of the stack trace.\n+\n+    :return:\n+        A list of strings, each representing a stack frame, in the same format\n+        as ``traceback.format_stack()``.\n+    \"\"\"\n+    stack = traceback.format_stack()\n+\n+    def is_boring(entry):\n+        return all(pathfrag not in entry for pathfrag in [\n+            \"twisted/trial/_asynctest.py\",\n+            \"django/test/testcases.py\",\n+        ])\n+\n+    filtered_stack = list(dropwhile(is_boring, stack))\n+    if filtered_stack:\n+        # We haven't accidentally devoured everything.\n+        lines_removed = len(stack) - len(filtered_stack)\n+        stack = filtered_stack\n+        stack.insert(0, \"%s test runner lines removed.\\n\" % lines_removed)\n+    # Remove the current stack frame and any extra stack frames we've been\n+    # asked to remove.\n+    return stack[:-(exclude_last + 1)]","path":"vumi/tests/helpers.py","position":47,"original_position":47,"commit_id":"2d95a875787984f3d0a20e039b0e728f26a2ad55","original_commit_id":"2d95a875787984f3d0a20e039b0e728f26a2ad55","user":{"login":"rudigiesler","id":8234653,"avatar_url":"https://avatars.githubusercontent.com/u/8234653?v=3","gravatar_id":"","url":"https://api.github.com/users/rudigiesler","html_url":"https://github.com/rudigiesler","followers_url":"https://api.github.com/users/rudigiesler/followers","following_url":"https://api.github.com/users/rudigiesler/following{/other_user}","gists_url":"https://api.github.com/users/rudigiesler/gists{/gist_id}","starred_url":"https://api.github.com/users/rudigiesler/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rudigiesler/subscriptions","organizations_url":"https://api.github.com/users/rudigiesler/orgs","repos_url":"https://api.github.com/users/rudigiesler/repos","events_url":"https://api.github.com/users/rudigiesler/events{/privacy}","received_events_url":"https://api.github.com/users/rudigiesler/received_events","type":"User","site_admin":false},"body":"Wouldn't this mean that the `%s test runner lines removed` line might be removed?","created_at":"2015-06-26T08:22:51Z","updated_at":"2015-06-26T08:22:51Z","html_url":"https://github.com/praekelt/vumi/pull/957#discussion_r33337029","pull_request_url":"https://api.github.com/repos/praekelt/vumi/pulls/957","_links":{"self":{"href":"https://api.github.com/repos/praekelt/vumi/pulls/comments/33337029"},"html":{"href":"https://github.com/praekelt/vumi/pull/957#discussion_r33337029"},"pull_request":{"href":"https://api.github.com/repos/praekelt/vumi/pulls/957"}}},"pull_request":{"url":"https://api.github.com/repos/praekelt/vumi/pulls/957","id":38535792,"html_url":"https://github.com/praekelt/vumi/pull/957","diff_url":"https://github.com/praekelt/vumi/pull/957.diff","patch_url":"https://github.com/praekelt/vumi/pull/957.patch","issue_url":"https://api.github.com/repos/praekelt/vumi/issues/957","number":957,"state":"open","locked":false,"title":"Ensure Riak clients properly cleaned up (#950)","user":{"login":"jerith","id":43731,"avatar_url":"https://avatars.githubusercontent.com/u/43731?v=3","gravatar_id":"","url":"https://api.github.com/users/jerith","html_url":"https://github.com/jerith","followers_url":"https://api.github.com/users/jerith/followers","following_url":"https://api.github.com/users/jerith/following{/other_user}","gists_url":"https://api.github.com/users/jerith/gists{/gist_id}","starred_url":"https://api.github.com/users/jerith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerith/subscriptions","organizations_url":"https://api.github.com/users/jerith/orgs","repos_url":"https://api.github.com/users/jerith/repos","events_url":"https://api.github.com/users/jerith/events{/privacy}","received_events_url":"https://api.github.com/users/jerith/received_events","type":"User","site_admin":false},"body":"This is a reimplementation of #950.","created_at":"2015-06-25T11:07:34Z","updated_at":"2015-06-26T08:22:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ae44073bc60edc6593362f314856d711db1ddd2b","assignee":{"login":"jerith","id":43731,"avatar_url":"https://avatars.githubusercontent.com/u/43731?v=3","gravatar_id":"","url":"https://api.github.com/users/jerith","html_url":"https://github.com/jerith","followers_url":"https://api.github.com/users/jerith/followers","following_url":"https://api.github.com/users/jerith/following{/other_user}","gists_url":"https://api.github.com/users/jerith/gists{/gist_id}","starred_url":"https://api.github.com/users/jerith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jerith/subscriptions","organizations_url":"https://api.github.com/users/jerith/orgs","repos_url":"https://api.github.com/users/jerith/repos","events_url":"https://api.github.com/users/jerith/events{/privacy}","received_events_url":"https://api.github.com/users/jerith/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/praekelt/vumi/pulls/957/commits","review_comments_url":"https://api.github.com/repos/praekelt/vumi/pulls/957/comments","review_comment_url":"https://api.github.com/repos/praekelt/vumi/pulls/comments{/number}","comments_url":"https://api.github.com/repos/praekelt/vumi/issues/957/comments","statuses_url":"https://api.github.com/repos/praekelt/vumi/statuses/2d95a875787984f3d0a20e039b0e728f26a2ad55","head":{"label":"praekelt:feature/issue-950-2-ensure-riak-clients-properly-cleaned-up","ref":"feature/issue-950-2-ensure-riak-clients-properly-cleaned-up","sha":"2d95a875787984f3d0a20e039b0e728f26a2ad55","user":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"repo":{"id":1081665,"name":"vumi","full_name":"praekelt/vumi","owner":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/praekelt/vumi","description":"Messaging engine for the delivery of SMS, Star Menu and chat messages to diverse audiences in emerging markets and beyond.","fork":false,"url":"https://api.github.com/repos/praekelt/vumi","forks_url":"https://api.github.com/repos/praekelt/vumi/forks","keys_url":"https://api.github.com/repos/praekelt/vumi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/praekelt/vumi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/praekelt/vumi/teams","hooks_url":"https://api.github.com/repos/praekelt/vumi/hooks","issue_events_url":"https://api.github.com/repos/praekelt/vumi/issues/events{/number}","events_url":"https://api.github.com/repos/praekelt/vumi/events","assignees_url":"https://api.github.com/repos/praekelt/vumi/assignees{/user}","branches_url":"https://api.github.com/repos/praekelt/vumi/branches{/branch}","tags_url":"https://api.github.com/repos/praekelt/vumi/tags","blobs_url":"https://api.github.com/repos/praekelt/vumi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/praekelt/vumi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/praekelt/vumi/git/refs{/sha}","trees_url":"https://api.github.com/repos/praekelt/vumi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/praekelt/vumi/statuses/{sha}","languages_url":"https://api.github.com/repos/praekelt/vumi/languages","stargazers_url":"https://api.github.com/repos/praekelt/vumi/stargazers","contributors_url":"https://api.github.com/repos/praekelt/vumi/contributors","subscribers_url":"https://api.github.com/repos/praekelt/vumi/subscribers","subscription_url":"https://api.github.com/repos/praekelt/vumi/subscription","commits_url":"https://api.github.com/repos/praekelt/vumi/commits{/sha}","git_commits_url":"https://api.github.com/repos/praekelt/vumi/git/commits{/sha}","comments_url":"https://api.github.com/repos/praekelt/vumi/comments{/number}","issue_comment_url":"https://api.github.com/repos/praekelt/vumi/issues/comments{/number}","contents_url":"https://api.github.com/repos/praekelt/vumi/contents/{+path}","compare_url":"https://api.github.com/repos/praekelt/vumi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/praekelt/vumi/merges","archive_url":"https://api.github.com/repos/praekelt/vumi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/praekelt/vumi/downloads","issues_url":"https://api.github.com/repos/praekelt/vumi/issues{/number}","pulls_url":"https://api.github.com/repos/praekelt/vumi/pulls{/number}","milestones_url":"https://api.github.com/repos/praekelt/vumi/milestones{/number}","notifications_url":"https://api.github.com/repos/praekelt/vumi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/praekelt/vumi/labels{/name}","releases_url":"https://api.github.com/repos/praekelt/vumi/releases{/id}","created_at":"2010-11-15T11:34:03Z","updated_at":"2015-06-18T13:35:39Z","pushed_at":"2015-06-25T11:07:36Z","git_url":"git://github.com/praekelt/vumi.git","ssh_url":"git@github.com:praekelt/vumi.git","clone_url":"https://github.com/praekelt/vumi.git","svn_url":"https://github.com/praekelt/vumi","homepage":"","size":21732,"stargazers_count":220,"watchers_count":220,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":83,"mirror_url":null,"open_issues_count":94,"forks":83,"open_issues":94,"watchers":220,"default_branch":"develop"}},"base":{"label":"praekelt:develop","ref":"develop","sha":"00e5bc0cf5eab6598e3203c4deffb06539d80c3e","user":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"repo":{"id":1081665,"name":"vumi","full_name":"praekelt/vumi","owner":{"login":"praekelt","id":81810,"avatar_url":"https://avatars.githubusercontent.com/u/81810?v=3","gravatar_id":"","url":"https://api.github.com/users/praekelt","html_url":"https://github.com/praekelt","followers_url":"https://api.github.com/users/praekelt/followers","following_url":"https://api.github.com/users/praekelt/following{/other_user}","gists_url":"https://api.github.com/users/praekelt/gists{/gist_id}","starred_url":"https://api.github.com/users/praekelt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/praekelt/subscriptions","organizations_url":"https://api.github.com/users/praekelt/orgs","repos_url":"https://api.github.com/users/praekelt/repos","events_url":"https://api.github.com/users/praekelt/events{/privacy}","received_events_url":"https://api.github.com/users/praekelt/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/praekelt/vumi","description":"Messaging engine for the delivery of SMS, Star Menu and chat messages to diverse audiences in emerging markets and beyond.","fork":false,"url":"https://api.github.com/repos/praekelt/vumi","forks_url":"https://api.github.com/repos/praekelt/vumi/forks","keys_url":"https://api.github.com/repos/praekelt/vumi/keys{/key_id}","collaborators_url":"https://api.github.com/repos/praekelt/vumi/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/praekelt/vumi/teams","hooks_url":"https://api.github.com/repos/praekelt/vumi/hooks","issue_events_url":"https://api.github.com/repos/praekelt/vumi/issues/events{/number}","events_url":"https://api.github.com/repos/praekelt/vumi/events","assignees_url":"https://api.github.com/repos/praekelt/vumi/assignees{/user}","branches_url":"https://api.github.com/repos/praekelt/vumi/branches{/branch}","tags_url":"https://api.github.com/repos/praekelt/vumi/tags","blobs_url":"https://api.github.com/repos/praekelt/vumi/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/praekelt/vumi/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/praekelt/vumi/git/refs{/sha}","trees_url":"https://api.github.com/repos/praekelt/vumi/git/trees{/sha}","statuses_url":"https://api.github.com/repos/praekelt/vumi/statuses/{sha}","languages_url":"https://api.github.com/repos/praekelt/vumi/languages","stargazers_url":"https://api.github.com/repos/praekelt/vumi/stargazers","contributors_url":"https://api.github.com/repos/praekelt/vumi/contributors","subscribers_url":"https://api.github.com/repos/praekelt/vumi/subscribers","subscription_url":"https://api.github.com/repos/praekelt/vumi/subscription","commits_url":"https://api.github.com/repos/praekelt/vumi/commits{/sha}","git_commits_url":"https://api.github.com/repos/praekelt/vumi/git/commits{/sha}","comments_url":"https://api.github.com/repos/praekelt/vumi/comments{/number}","issue_comment_url":"https://api.github.com/repos/praekelt/vumi/issues/comments{/number}","contents_url":"https://api.github.com/repos/praekelt/vumi/contents/{+path}","compare_url":"https://api.github.com/repos/praekelt/vumi/compare/{base}...{head}","merges_url":"https://api.github.com/repos/praekelt/vumi/merges","archive_url":"https://api.github.com/repos/praekelt/vumi/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/praekelt/vumi/downloads","issues_url":"https://api.github.com/repos/praekelt/vumi/issues{/number}","pulls_url":"https://api.github.com/repos/praekelt/vumi/pulls{/number}","milestones_url":"https://api.github.com/repos/praekelt/vumi/milestones{/number}","notifications_url":"https://api.github.com/repos/praekelt/vumi/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/praekelt/vumi/labels{/name}","releases_url":"https://api.github.com/repos/praekelt/vumi/releases{/id}","created_at":"2010-11-15T11:34:03Z","updated_at":"2015-06-18T13:35:39Z","pushed_at":"2015-06-25T11:07:36Z","git_url":"git://github.com/praekelt/vumi.git","ssh_url":"git@github.com:praekelt/vumi.git","clone_url":"https://github.com/praekelt/vumi.git","svn_url":"https://github.com/praekelt/vumi","homepage":"","size":21732,"stargazers_count":220,"watchers_count":220,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":83,"mirror_url":null,"open_issues_count":94,"forks":83,"open_issues":94,"watchers":220,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/praekelt/vumi/pulls/957"},"html":{"href":"https://github.com/praekelt/vumi/pull/957"},"issue":{"href":"https://api.github.com/repos/praekelt/vumi/issues/957"},"comments":{"href":"https://api.github.com/repos/praekelt/vumi/issues/957/comments"},"review_comments":{"href":"https://api.github.com/repos/praekelt/vumi/pulls/957/comments"},"review_comment":{"href":"https://api.github.com/repos/praekelt/vumi/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/praekelt/vumi/pulls/957/commits"},"statuses":{"href":"https://api.github.com/repos/praekelt/vumi/statuses/2d95a875787984f3d0a20e039b0e728f26a2ad55"}}}}