{"action":"created","issue":{"url":"https://api.github.com/repos/tornadoweb/tornado/issues/1154","repository_url":"https://api.github.com/repos/tornadoweb/tornado","labels_url":"https://api.github.com/repos/tornadoweb/tornado/issues/1154/labels{/name}","comments_url":"https://api.github.com/repos/tornadoweb/tornado/issues/1154/comments","events_url":"https://api.github.com/repos/tornadoweb/tornado/issues/1154/events","html_url":"https://github.com/tornadoweb/tornado/issues/1154","id":40916779,"number":1154,"title":"Tornado 4.0.1, AsyncHTTPTestCase, IOLoop is already running","user":{"login":"hgenru","id":2411525,"avatar_url":"https://avatars2.githubusercontent.com/u/2411525?v=3","gravatar_id":"","url":"https://api.github.com/users/hgenru","html_url":"https://github.com/hgenru","followers_url":"https://api.github.com/users/hgenru/followers","following_url":"https://api.github.com/users/hgenru/following{/other_user}","gists_url":"https://api.github.com/users/hgenru/gists{/gist_id}","starred_url":"https://api.github.com/users/hgenru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hgenru/subscriptions","organizations_url":"https://api.github.com/users/hgenru/orgs","repos_url":"https://api.github.com/users/hgenru/repos","events_url":"https://api.github.com/users/hgenru/events{/privacy}","received_events_url":"https://api.github.com/users/hgenru/received_events","type":"User","site_admin":false},"labels":[{"id":131319754,"url":"https://api.github.com/repos/tornadoweb/tornado/labels/testing","name":"testing","color":"0052cc","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2014-08-22T15:02:49Z","updated_at":"2017-06-08T22:43:21Z","closed_at":null,"body":"After the upgrade, there was a problem with the use of tornado.testing tools.\n\nI'm run this simple code: https://gist.github.com/hgenru/47ad817a199de2e33333\n\n```\n(env)➜ pip install tornado==3.2\n\n(env)➜ env/bin/nosetests\n.\n----------------------------------------------------------------------\nRan 1 test in 0.082s\n\nOK\n\n\n(env)➜ pip uninstall tornado && pip install tornado\n(env)➜ env/bin/nosetests\nE\n======================================================================\nERROR: test_response (test.HelloHandlerTest)\n----------------------------------------------------------------------\nTraceback (most recent call last):\n  File \"/home/hgen/test/47ad817a199de2e33333/env/lib/python3.4/site-packages/tornado/testing.py\", line 118, in __call__\n    result = self.orig_method()\n  File \"/home/hgen/test/47ad817a199de2e33333/env/lib/python3.4/site-packages/tornado/testing.py\", line 494, in post_coroutine\n    timeout=timeout)\n  File \"/home/hgen/test/47ad817a199de2e33333/env/lib/python3.4/site-packages/tornado/ioloop.py\", line 418, in run_sync\n    return future_cell[0].result()\n  File \"/home/hgen/test/47ad817a199de2e33333/env/lib/python3.4/site-packages/tornado/concurrent.py\", line 109, in result\n    raise_exc_info(self._exc_info)\n  File \"<string>\", line 3, in raise_exc_info\n  File \"/home/hgen/test/47ad817a199de2e33333/env/lib/python3.4/site-packages/tornado/gen.py\", line 160, in wrapper\n    result = func(*args, **kwargs)\n  File \"/home/hgen/test/47ad817a199de2e33333/env/lib/python3.4/site-packages/tornado/testing.py\", line 480, in pre_coroutine\n    result = f(self, *args, **kwargs)\n  File \"/home/hgen/test/47ad817a199de2e33333/test.py\", line 15, in test_response\n    res = self.fetch('/')\n  File \"/home/hgen/test/47ad817a199de2e33333/env/lib/python3.4/site-packages/tornado/testing.py\", line 373, in fetch\n    return self.wait()\n  File \"/home/hgen/test/47ad817a199de2e33333/env/lib/python3.4/site-packages/tornado/testing.py\", line 303, in wait\n    self.io_loop.start()\n  File \"/home/hgen/test/47ad817a199de2e33333/env/lib/python3.4/site-packages/tornado/ioloop.py\", line 704, in start\n    raise RuntimeError(\"IOLoop is already running\")\nRuntimeError: IOLoop is already running\n\n----------------------------------------------------------------------\nRan 1 test in 0.075s\n\nFAILED (errors=1)\n```\n"},"comment":{"url":"https://api.github.com/repos/tornadoweb/tornado/issues/comments/307247346","html_url":"https://github.com/tornadoweb/tornado/issues/1154#issuecomment-307247346","issue_url":"https://api.github.com/repos/tornadoweb/tornado/issues/1154","id":307247346,"user":{"login":"Groxx","id":77197,"avatar_url":"https://avatars1.githubusercontent.com/u/77197?v=3","gravatar_id":"","url":"https://api.github.com/users/Groxx","html_url":"https://github.com/Groxx","followers_url":"https://api.github.com/users/Groxx/followers","following_url":"https://api.github.com/users/Groxx/following{/other_user}","gists_url":"https://api.github.com/users/Groxx/gists{/gist_id}","starred_url":"https://api.github.com/users/Groxx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Groxx/subscriptions","organizations_url":"https://api.github.com/users/Groxx/orgs","repos_url":"https://api.github.com/users/Groxx/repos","events_url":"https://api.github.com/users/Groxx/events{/privacy}","received_events_url":"https://api.github.com/users/Groxx/received_events","type":"User","site_admin":false},"created_at":"2017-06-08T22:43:21Z","updated_at":"2017-06-08T22:43:21Z","body":"Is this still an issue?  Tornado 4.5.1, and docs say\r\n```python\r\nclass MyTest(AsyncHTTPTestCase):\r\n    @gen_test\r\n    def test_something(self):\r\n        response = yield gen.Task(self.fetch('/'))\r\n```\r\nbut I get the same error unless I do this (complete, runnable example):\r\n```python\r\nfrom tornado.web import Application, RequestHandler\r\nfrom tornado.testing import AsyncHTTPTestCase, gen_test\r\n\r\nclass Http(RequestHandler):\r\n    def get(self):\r\n        self.write('OK')\r\n\r\nclass TestHttp(AsyncHTTPTestCase):\r\n    def get_app(self):\r\n        return Application([(r'/', Http)])\r\n\r\n    @gen_test\r\n    def test_which_works(self):\r\n        response = yield self.http_client.fetch(self.get_url('/'))\r\n```\r\nhttp://www.tornadoweb.org/en/stable/testing.html#tornado.testing.gen_test"}}
{"actor":{"display_login":"Groxx"}}