Skip to content

Commit

Permalink
uprev
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Oct 31, 2016
1 parent 914b8f1 commit 63c6498
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
2 changes: 1 addition & 1 deletion aiohttp_devtools/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

__all__ = ['VERSION']

VERSION = StrictVersion('0.0.1')
VERSION = StrictVersion('0.0.2')
26 changes: 9 additions & 17 deletions tests/test_runserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@

from .conftest import mktree

async def test_start_runserver(loop, tmpworkdir):
mktree(tmpworkdir, {
'app.py': """\
SIMPLE_APP = {
'app.py': """\
from aiohttp import web
async def hello(request):
Expand All @@ -19,8 +18,11 @@ async def hello(request):
def create_app(loop):
app = web.Application(loop=loop)
app.router.add_get('/', hello)
return app""",
})
return app"""}


async def test_start_runserver(loop, tmpworkdir):
mktree(tmpworkdir, SIMPLE_APP)
aux_app, observer, aux_port = runserver(app_path='app.py', loop=loop)
assert isinstance(aux_app, aiohttp.web.Application)
assert aux_port == 8001
Expand All @@ -40,25 +42,15 @@ def create_app(loop):
break
assert app_running

assert len(observer._handlers) == 1
event_handlers = list(observer._handlers.values())[0]
assert len(event_handlers) == 2
code_event_handler = next(eh for eh in event_handlers if isinstance(eh, PyCodeEventHandler))
code_event_handler._process.terminate()


async def test_run_app(loop, tmpworkdir, test_client):
mktree(tmpworkdir, {
'app.py': """\
from aiohttp import web
async def hello(request):
return web.Response(text='hello world')
def create_app(loop):
app = web.Application(loop=loop)
app.router.add_get('/', hello)
return app""",
})
mktree(tmpworkdir, SIMPLE_APP)
app = create_main_app(app_path='app.py', loop=loop)
assert isinstance(app, aiohttp.web.Application)
cli = await test_client(app)
Expand Down

0 comments on commit 63c6498

Please sign in to comment.