{"action":"created","issue":{"url":"https://api.github.com/repos/pallets/flask/issues/1680","repository_url":"https://api.github.com/repos/pallets/flask","labels_url":"https://api.github.com/repos/pallets/flask/issues/1680/labels{/name}","comments_url":"https://api.github.com/repos/pallets/flask/issues/1680/comments","events_url":"https://api.github.com/repos/pallets/flask/issues/1680/events","html_url":"https://github.com/pallets/flask/issues/1680","id":124613351,"number":1680,"title":"Flask isn't doctestable","user":{"login":"sils1297","id":5716520,"avatar_url":"https://avatars.githubusercontent.com/u/5716520?v=3","gravatar_id":"","url":"https://api.github.com/users/sils1297","html_url":"https://github.com/sils1297","followers_url":"https://api.github.com/users/sils1297/followers","following_url":"https://api.github.com/users/sils1297/following{/other_user}","gists_url":"https://api.github.com/users/sils1297/gists{/gist_id}","starred_url":"https://api.github.com/users/sils1297/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sils1297/subscriptions","organizations_url":"https://api.github.com/users/sils1297/orgs","repos_url":"https://api.github.com/users/sils1297/repos","events_url":"https://api.github.com/users/sils1297/events{/privacy}","received_events_url":"https://api.github.com/users/sils1297/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":24,"created_at":"2016-01-02T21:57:37Z","updated_at":"2016-04-23T06:44:47Z","closed_at":null,"body":"```\r\nlasse@lssteady ~/tmp/pytesttest % cat asd.py \r\nfrom flask import request\r\n\r\ndef addstuff(a,b):\r\n    \"\"\"\r\n    Adds stuff:\r\n    \r\n    >>> addstuff(4,5)\r\n    9\r\n    \r\n    See?\r\n    \"\"\"\r\n    return a+b\r\n\r\nlasse@lssteady ~/tmp/pytesttest % python3   \r\nPython 3.5.1 (default, Dec  7 2015, 12:58:09) \r\n[GCC 5.2.0] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> import asd\r\n>>> import doctest\r\n>>> doctest.testmod(asd)\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/usr/lib/python3.5/doctest.py\", line 1940, in testmod\r\n    for test in finder.find(m, name, globs=globs, extraglobs=extraglobs):\r\n  File \"/usr/lib/python3.5/doctest.py\", line 923, in find\r\n    self._find(tests, obj, name, module, source_lines, globs, {})\r\n  File \"/usr/lib/python3.5/doctest.py\", line 982, in _find\r\n    if ((inspect.isroutine(inspect.unwrap(val))\r\n  File \"/usr/lib/python3.5/inspect.py\", line 471, in unwrap\r\n    while _is_wrapper(func):\r\n  File \"/usr/lib/python3.5/inspect.py\", line 465, in _is_wrapper\r\n    return hasattr(f, '__wrapped__')\r\n  File \"/usr/lib/python3.5/site-packages/werkzeug/local.py\", line 343, in __getattr__\r\n    return getattr(self._get_current_object(), name)\r\n  File \"/usr/lib/python3.5/site-packages/werkzeug/local.py\", line 302, in _get_current_object\r\n    return self.__local()\r\n  File \"/usr/lib/python3.5/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\n\r\nAnyone any idea what happens there? I'd love to doctest my Flask application since it's especially awesome to document endpoints."},"comment":{"url":"https://api.github.com/repos/pallets/flask/issues/comments/213675853","html_url":"https://github.com/pallets/flask/issues/1680#issuecomment-213675853","issue_url":"https://api.github.com/repos/pallets/flask/issues/1680","id":213675853,"user":{"login":"RonnyPfannschmidt","id":156838,"avatar_url":"https://avatars.githubusercontent.com/u/156838?v=3","gravatar_id":"","url":"https://api.github.com/users/RonnyPfannschmidt","html_url":"https://github.com/RonnyPfannschmidt","followers_url":"https://api.github.com/users/RonnyPfannschmidt/followers","following_url":"https://api.github.com/users/RonnyPfannschmidt/following{/other_user}","gists_url":"https://api.github.com/users/RonnyPfannschmidt/gists{/gist_id}","starred_url":"https://api.github.com/users/RonnyPfannschmidt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RonnyPfannschmidt/subscriptions","organizations_url":"https://api.github.com/users/RonnyPfannschmidt/orgs","repos_url":"https://api.github.com/users/RonnyPfannschmidt/repos","events_url":"https://api.github.com/users/RonnyPfannschmidt/events{/privacy}","received_events_url":"https://api.github.com/users/RonnyPfannschmidt/received_events","type":"User","site_admin":false},"created_at":"2016-04-23T06:44:47Z","updated_at":"2016-04-23T06:44:47Z","body":"any doctest will have to push an known context to work correctly\r\n\r\nsimply setting something to None is bound to break other bits"}}