Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement test_client can accept instance object. #1083

Merged
merged 7 commits into from
Aug 16, 2016
11 changes: 10 additions & 1 deletion tests/test_pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ def test_myplugin(testdir):
testdir.makepyfile("""\
import asyncio
import pytest
from unittest import mock

from aiohttp import web

pytest_plugins = 'aiohttp.pytest_plugin'
Expand Down Expand Up @@ -59,6 +61,13 @@ def test_hello_fails(test_client):
assert 'Hello, wield' in text


@asyncio.coroutine
def test_hello_from_app_fails(test_client):
with pytest.raises(AssertionError):
fake_loop = mock.Mock()
test_client(web.Application(loop=fake_loop))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yield from test_client(...) -- that's why this test fails

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh my god !! thanks !!!



@asyncio.coroutine
def test_noop():
pass
Expand Down Expand Up @@ -122,4 +131,4 @@ def make_app(loop):

""")
result = testdir.runpytest('-p', 'no:sugar')
result.assert_outcomes(passed=8, failed=1)
result.assert_outcomes(passed=8, failed=2)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why is it failing? If it fails it means that assertion is not raised.