{"action":"created","issue":{"url":"https://api.github.com/repos/vitalk/pytest-flask/issues/38","labels_url":"https://api.github.com/repos/vitalk/pytest-flask/issues/38/labels{/name}","comments_url":"https://api.github.com/repos/vitalk/pytest-flask/issues/38/comments","events_url":"https://api.github.com/repos/vitalk/pytest-flask/issues/38/events","html_url":"https://github.com/vitalk/pytest-flask/pull/38","id":118807777,"number":38,"title":"Fix issue, with request teardown during test teardown instead of test run.","user":{"login":"AndrewPashkin","id":4378647,"avatar_url":"https://avatars.githubusercontent.com/u/4378647?v=3","gravatar_id":"","url":"https://api.github.com/users/AndrewPashkin","html_url":"https://github.com/AndrewPashkin","followers_url":"https://api.github.com/users/AndrewPashkin/followers","following_url":"https://api.github.com/users/AndrewPashkin/following{/other_user}","gists_url":"https://api.github.com/users/AndrewPashkin/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewPashkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewPashkin/subscriptions","organizations_url":"https://api.github.com/users/AndrewPashkin/orgs","repos_url":"https://api.github.com/users/AndrewPashkin/repos","events_url":"https://api.github.com/users/AndrewPashkin/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewPashkin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-11-25T10:41:39Z","updated_at":"2015-11-26T08:35:06Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/vitalk/pytest-flask/pulls/38","html_url":"https://github.com/vitalk/pytest-flask/pull/38","diff_url":"https://github.com/vitalk/pytest-flask/pull/38.diff","patch_url":"https://github.com/vitalk/pytest-flask/pull/38.patch"},"body":"I had a setup, where each test was wrapped in transaction and each in it's turn was wrapped in sub-transaction. Both transaction was rolled back in the end, request's in `app.teardown_request` and test's in PyTest test teardown. And the issue was, that  test transaction was rolled back before request transaction, so sub-transaction was rolled back after top-level one. \r\n\r\nBut there is a problem - this change breaks keeping context around feature."},"comment":{"url":"https://api.github.com/repos/vitalk/pytest-flask/issues/comments/159847381","html_url":"https://github.com/vitalk/pytest-flask/pull/38#issuecomment-159847381","issue_url":"https://api.github.com/repos/vitalk/pytest-flask/issues/38","id":159847381,"user":{"login":"AndrewPashkin","id":4378647,"avatar_url":"https://avatars.githubusercontent.com/u/4378647?v=3","gravatar_id":"","url":"https://api.github.com/users/AndrewPashkin","html_url":"https://github.com/AndrewPashkin","followers_url":"https://api.github.com/users/AndrewPashkin/followers","following_url":"https://api.github.com/users/AndrewPashkin/following{/other_user}","gists_url":"https://api.github.com/users/AndrewPashkin/gists{/gist_id}","starred_url":"https://api.github.com/users/AndrewPashkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndrewPashkin/subscriptions","organizations_url":"https://api.github.com/users/AndrewPashkin/orgs","repos_url":"https://api.github.com/users/AndrewPashkin/repos","events_url":"https://api.github.com/users/AndrewPashkin/events{/privacy}","received_events_url":"https://api.github.com/users/AndrewPashkin/received_events","type":"User","site_admin":false},"created_at":"2015-11-26T08:35:06Z","updated_at":"2015-11-26T08:35:06Z","body":"The second statement is not correct - context is not being pushed anymore, so you need to create it manually, using `test_request_context()` method."}}