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

add pytest_plugins #914

Merged
merged 4 commits into from
Jul 9, 2016
Merged

add pytest_plugins #914

merged 4 commits into from
Jul 9, 2016

Conversation

samuelcolvin
Copy link
Member

@samuelcolvin samuelcolvin commented Jun 4, 2016

What do these changes do?

Add custom plugin to support testing with pytest. Therefore:

  • remove the reliance on pytest-asyncio.
  • remove all unnecessary boilerplate from tests making getting started with tests easier.

I'm submitting it before I finish it to see if you're willing to merge this idea?

Are there changes in behavior for the user?

Making testing as easy as possible, for example:

from aiohttp import web
pytest_plugins = 'aiohttp.pytest_plugins'

async 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

async def test_hello(test_client):
    client = await test_client(create_app)
    resp = await client.get('/')
    assert resp.status == 200
    text = await resp.text()
    assert 'Hello, world' in text

Related issue number

#423

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes

@coveralls
Copy link

coveralls commented Jun 4, 2016

Coverage Status

Coverage decreased (-0.7%) to 97.433% when pulling 816c72f on samuelcolvin:pytest-plugins into fc2b408 on KeepSafe:master.

@coveralls
Copy link

coveralls commented Jun 4, 2016

Coverage Status

Coverage decreased (-0.5%) to 97.588% when pulling d8724a6 on samuelcolvin:pytest-plugins into fc2b408 on KeepSafe:master.

@asvetlov
Copy link
Member

asvetlov commented Jun 5, 2016

Looks good!

@coveralls
Copy link

coveralls commented Jun 7, 2016

Coverage Status

Coverage decreased (-0.1%) to 97.962% when pulling 1cbed6e on samuelcolvin:pytest-plugins into f180199 on KeepSafe:master.

@coveralls
Copy link

coveralls commented Jun 7, 2016

Coverage Status

Coverage decreased (-0.1%) to 97.962% when pulling 0aa25b2 on samuelcolvin:pytest-plugins into f180199 on KeepSafe:master.

@samuelcolvin
Copy link
Member Author

ready.

@samuelcolvin
Copy link
Member Author

If this is ok it would be great to get it merged before the next release.

@asvetlov asvetlov merged commit 317e97d into aio-libs:master Jul 9, 2016
@asvetlov
Copy link
Member

asvetlov commented Jul 9, 2016

Merged. Thank you very much.

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants