-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
set minimum version of pytest in c-requirements
- Loading branch information
1 parent
d8724a6
commit 1cbed6e
Showing
2 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ cython | |
chardet | ||
tox | ||
sphinxcontrib-newsfeed | ||
pytest | ||
pytest>=2.9.2 | ||
pytest-cov | ||
gunicorn | ||
pygments>=2.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
pytest_plugins = 'pytester' | ||
|
||
|
||
def test_myplugin(testdir): | ||
testdir.makepyfile("""\ | ||
import asyncio | ||
import pytest | ||
from aiohttp import web | ||
pytest_plugins = 'aiohttp.pytest_plugins' | ||
@asyncio.coroutine | ||
def hello(request): | ||
return web.Response(body=b'Hello, world') | ||
def create_app(loop): | ||
app = web.Application(loop=loop) | ||
app.router.add_route('GET', '/', hello) | ||
return app | ||
@asyncio.coroutine | ||
def test_hello(test_client): | ||
client = yield from test_client(create_app) | ||
resp = yield from client.get('/') | ||
assert resp.status == 200 | ||
text = yield from resp.text() | ||
assert 'Hello, world' in text | ||
@asyncio.coroutine | ||
def test_hello_with_loop(test_client, loop): | ||
client = yield from test_client(create_app) | ||
resp = yield from client.get('/') | ||
assert resp.status == 200 | ||
text = yield from resp.text() | ||
assert 'Hello, world' in text | ||
@asyncio.coroutine | ||
def test_hello_fails(test_client): | ||
client = yield from test_client(create_app) | ||
resp = yield from client.get('/') | ||
assert resp.status == 200 | ||
text = yield from resp.text() | ||
assert 'Hello, wield' in text | ||
@asyncio.coroutine | ||
def test_noop(): | ||
pass | ||
@pytest.fixture | ||
def client_alias(loop, test_client): | ||
cli = loop.run_until_complete(test_client(create_app)) | ||
return cli | ||
@asyncio.coroutine | ||
def test_hello_with_alias(client_alias): | ||
resp = yield from client_alias.get('/') | ||
assert resp.status == 200 | ||
text = yield from resp.text() | ||
assert 'Hello, world' in text | ||
""") | ||
result = testdir.runpytest() | ||
result.assert_outcomes(passed=4, failed=1) |