{"action":"opened","number":1000,"pull_request":{"url":"https://api.github.com/repos/ga4gh/server/pulls/1000","id":63451508,"html_url":"https://github.com/ga4gh/server/pull/1000","diff_url":"https://github.com/ga4gh/server/pull/1000.diff","patch_url":"https://github.com/ga4gh/server/pull/1000.patch","issue_url":"https://api.github.com/repos/ga4gh/server/issues/1000","number":1000,"state":"open","locked":false,"title":"Tests share state","user":{"login":"david4096","id":3795586,"avatar_url":"https://avatars.githubusercontent.com/u/3795586?v=3","gravatar_id":"","url":"https://api.github.com/users/david4096","html_url":"https://github.com/david4096","followers_url":"https://api.github.com/users/david4096/followers","following_url":"https://api.github.com/users/david4096/following{/other_user}","gists_url":"https://api.github.com/users/david4096/gists{/gist_id}","starred_url":"https://api.github.com/users/david4096/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david4096/subscriptions","organizations_url":"https://api.github.com/users/david4096/orgs","repos_url":"https://api.github.com/users/david4096/repos","events_url":"https://api.github.com/users/david4096/events{/privacy}","received_events_url":"https://api.github.com/users/david4096/received_events","type":"User","site_admin":false},"body":"Tests that act on `frontend` must set it to a pristine state before acting. This came up when testing sequence annotations end to end, the exceptions tests were failed because the development config had been activated in another test. This fix simply resets the `frontend`'s state for the test case.\r\n\r\nTo reproduce create a file `tests/unit/break_exceptions.py`\r\n\r\n```\r\n\"\"\"\r\nTests related to exceptions\r\n\"\"\"\r\nfrom __future__ import division\r\nfrom __future__ import print_function\r\nfrom __future__ import unicode_literals\r\n\r\nimport unittest\r\nimport inspect\r\n\r\nimport ga4gh.exceptions as exceptions\r\nimport ga4gh.frontend as frontend\r\nimport ga4gh.protocol as protocol\r\n\r\n\r\nclass TestBreakExceptions(unittest.TestCase):\r\n    \"\"\"\r\n    Test that caught exceptions are handled correctly\r\n    \"\"\"\r\n    @classmethod\r\n    def setUpClass(cls):\r\n        frontend.reset()\r\n        frontend.configure(baseConfig=\"DevelopmentConfig\")\r\n\r\n    def testCase(self):\r\n        pass\r\n```\r\n\r\nThen `nosetests tests.unit.break_exceptions tests.unit.test_exceptions`.\r\n\r\nWill give:\r\n\r\n```\r\n======================================================================\r\nERROR: testCallSetNotInVariantSetException (tests.unit.test_exceptions.TestExceptionHandler)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/Users/david/ga4gh/server-1/tests/unit/test_exceptions.py\", line 35, in testCallSetNotInVariantSetException\r\n    response = frontend.handleException(exception)\r\n  File \"/Users/david/ga4gh/server-1/ga4gh/frontend.py\", line 321, in handleException\r\n    app.log_exception(exception)\r\n  File \"/Users/david/ga4gh/server-1/server-1/lib/python2.7/site-packages/flask/app.py\", line 1421, in log_exception\r\n    request.path,\r\n  File \"/Users/david/ga4gh/server-1/server-1/lib/python2.7/site-packages/werkzeug/local.py\", line 343, in __getattr__\r\n    return getattr(self._get_current_object(), name)\r\n  File \"/Users/david/ga4gh/server-1/server-1/lib/python2.7/site-packages/werkzeug/local.py\", line 302, in _get_current_object\r\n    return self.__local()\r\n  File \"/Users/david/ga4gh/server-1/server-1/lib/python2.7/site-packages/flask/globals.py\", line 20, in _lookup_req_object\r\n    raise RuntimeError('working outside of request context')\r\nRuntimeError: working outside of request context\r\n\r\n======================================================================\r\nERROR: testNotImplementedException (tests.unit.test_exceptions.TestExceptionHandler)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/Users/david/ga4gh/server-1/tests/unit/test_exceptions.py\", line 50, in testNotImplementedException\r\n    response = frontend.handleException(exception)\r\n  File \"/Users/david/ga4gh/server-1/ga4gh/frontend.py\", line 321, in handleException\r\n    app.log_exception(exception)\r\n  File \"/Users/david/ga4gh/server-1/server-1/lib/python2.7/site-packages/flask/app.py\", line 1421, in log_exception\r\n    request.path,\r\n  File \"/Users/david/ga4gh/server-1/server-1/lib/python2.7/site-packages/werkzeug/local.py\", line 343, in __getattr__\r\n    return getattr(self._get_current_object(), name)\r\n  File \"/Users/david/ga4gh/server-1/server-1/lib/python2.7/site-packages/werkzeug/local.py\", line 302, in _get_current_object\r\n    return self.__local()\r\n  File \"/Users/david/ga4gh/server-1/server-1/lib/python2.7/site-packages/flask/globals.py\", line 20, in _lookup_req_object\r\n    raise RuntimeError('working outside of request context')\r\nRuntimeError: working outside of request context\r\n\r\n======================================================================\r\nERROR: testObjectNotFoundException (tests.unit.test_exceptions.TestExceptionHandler)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/Users/david/ga4gh/server-1/tests/unit/test_exceptions.py\", line 29, in testObjectNotFoundException\r\n    response = frontend.handleException(exception)\r\n  File \"/Users/david/ga4gh/server-1/ga4gh/frontend.py\", line 321, in handleException\r\n    app.log_exception(exception)\r\n  File \"/Users/david/ga4gh/server-1/server-1/lib/python2.7/site-packages/flask/app.py\", line 1421, in log_exception\r\n    request.path,\r\n  File \"/Users/david/ga4gh/server-1/server-1/lib/python2.7/site-packages/werkzeug/local.py\", line 343, in __getattr__\r\n    return getattr(self._get_current_object(), name)\r\n  File \"/Users/david/ga4gh/server-1/server-1/lib/python2.7/site-packages/werkzeug/local.py\", line 302, in _get_current_object\r\n    return self.__local()\r\n  File \"/Users/david/ga4gh/server-1/server-1/lib/python2.7/site-packages/flask/globals.py\", line 20, in _lookup_req_object\r\n    raise RuntimeError('working outside of request context')\r\nRuntimeError: working outside of request context\r\n\r\n======================================================================\r\nERROR: testUnknownExceptionBecomesServerError (tests.unit.test_exceptions.TestExceptionHandler)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/Users/david/ga4gh/server-1/tests/unit/test_exceptions.py\", line 42, in testUnknownExceptionBecomesServerError\r\n    response = frontend.handleException(exception)\r\n  File \"/Users/david/ga4gh/server-1/ga4gh/frontend.py\", line 321, in handleException\r\n    app.log_exception(exception)\r\n  File \"/Users/david/ga4gh/server-1/server-1/lib/python2.7/site-packages/flask/app.py\", line 1421, in log_exception\r\n    request.path,\r\n  File \"/Users/david/ga4gh/server-1/server-1/lib/python2.7/site-packages/werkzeug/local.py\", line 343, in __getattr__\r\n    return getattr(self._get_current_object(), name)\r\n  File \"/Users/david/ga4gh/server-1/server-1/lib/python2.7/site-packages/werkzeug/local.py\", line 302, in _get_current_object\r\n    return self.__local()\r\n  File \"/Users/david/ga4gh/server-1/server-1/lib/python2.7/site-packages/flask/globals.py\", line 20, in _lookup_req_object\r\n    raise RuntimeError('working outside of request context')\r\nRuntimeError: working outside of request context\r\n\r\n----------------------------------------------------------------------\r\nRan 9 tests in 0.051s\r\n\r\nFAILED (errors=4)\r\n```","created_at":"2016-03-19T00:06:17Z","updated_at":"2016-03-19T00:06:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ga4gh/server/pulls/1000/commits","review_comments_url":"https://api.github.com/repos/ga4gh/server/pulls/1000/comments","review_comment_url":"https://api.github.com/repos/ga4gh/server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ga4gh/server/issues/1000/comments","statuses_url":"https://api.github.com/repos/ga4gh/server/statuses/a0bd4c25abb1048da27e3933e98b63045e20e52a","head":{"label":"david4096:testfix_exceptions","ref":"testfix_exceptions","sha":"a0bd4c25abb1048da27e3933e98b63045e20e52a","user":{"login":"david4096","id":3795586,"avatar_url":"https://avatars.githubusercontent.com/u/3795586?v=3","gravatar_id":"","url":"https://api.github.com/users/david4096","html_url":"https://github.com/david4096","followers_url":"https://api.github.com/users/david4096/followers","following_url":"https://api.github.com/users/david4096/following{/other_user}","gists_url":"https://api.github.com/users/david4096/gists{/gist_id}","starred_url":"https://api.github.com/users/david4096/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david4096/subscriptions","organizations_url":"https://api.github.com/users/david4096/orgs","repos_url":"https://api.github.com/users/david4096/repos","events_url":"https://api.github.com/users/david4096/events{/privacy}","received_events_url":"https://api.github.com/users/david4096/received_events","type":"User","site_admin":false},"repo":{"id":47650356,"name":"server-1","full_name":"david4096/server-1","owner":{"login":"david4096","id":3795586,"avatar_url":"https://avatars.githubusercontent.com/u/3795586?v=3","gravatar_id":"","url":"https://api.github.com/users/david4096","html_url":"https://github.com/david4096","followers_url":"https://api.github.com/users/david4096/followers","following_url":"https://api.github.com/users/david4096/following{/other_user}","gists_url":"https://api.github.com/users/david4096/gists{/gist_id}","starred_url":"https://api.github.com/users/david4096/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/david4096/subscriptions","organizations_url":"https://api.github.com/users/david4096/orgs","repos_url":"https://api.github.com/users/david4096/repos","events_url":"https://api.github.com/users/david4096/events{/privacy}","received_events_url":"https://api.github.com/users/david4096/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/david4096/server-1","description":"A reference implementation of the APIs defined in the schemas repository.","fork":true,"url":"https://api.github.com/repos/david4096/server-1","forks_url":"https://api.github.com/repos/david4096/server-1/forks","keys_url":"https://api.github.com/repos/david4096/server-1/keys{/key_id}","collaborators_url":"https://api.github.com/repos/david4096/server-1/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/david4096/server-1/teams","hooks_url":"https://api.github.com/repos/david4096/server-1/hooks","issue_events_url":"https://api.github.com/repos/david4096/server-1/issues/events{/number}","events_url":"https://api.github.com/repos/david4096/server-1/events","assignees_url":"https://api.github.com/repos/david4096/server-1/assignees{/user}","branches_url":"https://api.github.com/repos/david4096/server-1/branches{/branch}","tags_url":"https://api.github.com/repos/david4096/server-1/tags","blobs_url":"https://api.github.com/repos/david4096/server-1/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/david4096/server-1/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/david4096/server-1/git/refs{/sha}","trees_url":"https://api.github.com/repos/david4096/server-1/git/trees{/sha}","statuses_url":"https://api.github.com/repos/david4096/server-1/statuses/{sha}","languages_url":"https://api.github.com/repos/david4096/server-1/languages","stargazers_url":"https://api.github.com/repos/david4096/server-1/stargazers","contributors_url":"https://api.github.com/repos/david4096/server-1/contributors","subscribers_url":"https://api.github.com/repos/david4096/server-1/subscribers","subscription_url":"https://api.github.com/repos/david4096/server-1/subscription","commits_url":"https://api.github.com/repos/david4096/server-1/commits{/sha}","git_commits_url":"https://api.github.com/repos/david4096/server-1/git/commits{/sha}","comments_url":"https://api.github.com/repos/david4096/server-1/comments{/number}","issue_comment_url":"https://api.github.com/repos/david4096/server-1/issues/comments{/number}","contents_url":"https://api.github.com/repos/david4096/server-1/contents/{+path}","compare_url":"https://api.github.com/repos/david4096/server-1/compare/{base}...{head}","merges_url":"https://api.github.com/repos/david4096/server-1/merges","archive_url":"https://api.github.com/repos/david4096/server-1/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/david4096/server-1/downloads","issues_url":"https://api.github.com/repos/david4096/server-1/issues{/number}","pulls_url":"https://api.github.com/repos/david4096/server-1/pulls{/number}","milestones_url":"https://api.github.com/repos/david4096/server-1/milestones{/number}","notifications_url":"https://api.github.com/repos/david4096/server-1/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/david4096/server-1/labels{/name}","releases_url":"https://api.github.com/repos/david4096/server-1/releases{/id}","deployments_url":"https://api.github.com/repos/david4096/server-1/deployments","created_at":"2015-12-08T21:23:22Z","updated_at":"2016-03-16T22:21:24Z","pushed_at":"2016-03-18T23:59:00Z","git_url":"git://github.com/david4096/server-1.git","ssh_url":"git@github.com:david4096/server-1.git","clone_url":"https://github.com/david4096/server-1.git","svn_url":"https://github.com/david4096/server-1","homepage":null,"size":4176,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ga4gh:master","ref":"master","sha":"074606d5b1654ef9a58e390311614a3f103d8628","user":{"login":"ga4gh","id":6921777,"avatar_url":"https://avatars.githubusercontent.com/u/6921777?v=3","gravatar_id":"","url":"https://api.github.com/users/ga4gh","html_url":"https://github.com/ga4gh","followers_url":"https://api.github.com/users/ga4gh/followers","following_url":"https://api.github.com/users/ga4gh/following{/other_user}","gists_url":"https://api.github.com/users/ga4gh/gists{/gist_id}","starred_url":"https://api.github.com/users/ga4gh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga4gh/subscriptions","organizations_url":"https://api.github.com/users/ga4gh/orgs","repos_url":"https://api.github.com/users/ga4gh/repos","events_url":"https://api.github.com/users/ga4gh/events{/privacy}","received_events_url":"https://api.github.com/users/ga4gh/received_events","type":"Organization","site_admin":false},"repo":{"id":22882621,"name":"server","full_name":"ga4gh/server","owner":{"login":"ga4gh","id":6921777,"avatar_url":"https://avatars.githubusercontent.com/u/6921777?v=3","gravatar_id":"","url":"https://api.github.com/users/ga4gh","html_url":"https://github.com/ga4gh","followers_url":"https://api.github.com/users/ga4gh/followers","following_url":"https://api.github.com/users/ga4gh/following{/other_user}","gists_url":"https://api.github.com/users/ga4gh/gists{/gist_id}","starred_url":"https://api.github.com/users/ga4gh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga4gh/subscriptions","organizations_url":"https://api.github.com/users/ga4gh/orgs","repos_url":"https://api.github.com/users/ga4gh/repos","events_url":"https://api.github.com/users/ga4gh/events{/privacy}","received_events_url":"https://api.github.com/users/ga4gh/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ga4gh/server","description":"A reference implementation of the APIs defined in the schemas repository.","fork":false,"url":"https://api.github.com/repos/ga4gh/server","forks_url":"https://api.github.com/repos/ga4gh/server/forks","keys_url":"https://api.github.com/repos/ga4gh/server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ga4gh/server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ga4gh/server/teams","hooks_url":"https://api.github.com/repos/ga4gh/server/hooks","issue_events_url":"https://api.github.com/repos/ga4gh/server/issues/events{/number}","events_url":"https://api.github.com/repos/ga4gh/server/events","assignees_url":"https://api.github.com/repos/ga4gh/server/assignees{/user}","branches_url":"https://api.github.com/repos/ga4gh/server/branches{/branch}","tags_url":"https://api.github.com/repos/ga4gh/server/tags","blobs_url":"https://api.github.com/repos/ga4gh/server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ga4gh/server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ga4gh/server/git/refs{/sha}","trees_url":"https://api.github.com/repos/ga4gh/server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ga4gh/server/statuses/{sha}","languages_url":"https://api.github.com/repos/ga4gh/server/languages","stargazers_url":"https://api.github.com/repos/ga4gh/server/stargazers","contributors_url":"https://api.github.com/repos/ga4gh/server/contributors","subscribers_url":"https://api.github.com/repos/ga4gh/server/subscribers","subscription_url":"https://api.github.com/repos/ga4gh/server/subscription","commits_url":"https://api.github.com/repos/ga4gh/server/commits{/sha}","git_commits_url":"https://api.github.com/repos/ga4gh/server/git/commits{/sha}","comments_url":"https://api.github.com/repos/ga4gh/server/comments{/number}","issue_comment_url":"https://api.github.com/repos/ga4gh/server/issues/comments{/number}","contents_url":"https://api.github.com/repos/ga4gh/server/contents/{+path}","compare_url":"https://api.github.com/repos/ga4gh/server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ga4gh/server/merges","archive_url":"https://api.github.com/repos/ga4gh/server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ga4gh/server/downloads","issues_url":"https://api.github.com/repos/ga4gh/server/issues{/number}","pulls_url":"https://api.github.com/repos/ga4gh/server/pulls{/number}","milestones_url":"https://api.github.com/repos/ga4gh/server/milestones{/number}","notifications_url":"https://api.github.com/repos/ga4gh/server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ga4gh/server/labels{/name}","releases_url":"https://api.github.com/repos/ga4gh/server/releases{/id}","deployments_url":"https://api.github.com/repos/ga4gh/server/deployments","created_at":"2014-08-12T15:31:49Z","updated_at":"2016-03-07T17:09:46Z","pushed_at":"2016-03-18T23:45:09Z","git_url":"git://github.com/ga4gh/server.git","ssh_url":"git@github.com:ga4gh/server.git","clone_url":"https://github.com/ga4gh/server.git","svn_url":"https://github.com/ga4gh/server","homepage":null,"size":6504,"stargazers_count":52,"watchers_count":52,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":80,"mirror_url":null,"open_issues_count":128,"forks":80,"open_issues":128,"watchers":52,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ga4gh/server/pulls/1000"},"html":{"href":"https://github.com/ga4gh/server/pull/1000"},"issue":{"href":"https://api.github.com/repos/ga4gh/server/issues/1000"},"comments":{"href":"https://api.github.com/repos/ga4gh/server/issues/1000/comments"},"review_comments":{"href":"https://api.github.com/repos/ga4gh/server/pulls/1000/comments"},"review_comment":{"href":"https://api.github.com/repos/ga4gh/server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ga4gh/server/pulls/1000/commits"},"statuses":{"href":"https://api.github.com/repos/ga4gh/server/statuses/a0bd4c25abb1048da27e3933e98b63045e20e52a"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":5,"deletions":0,"changed_files":1}}