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

Create pytest fixtures for integration tests #143

Open
jaraco opened this issue Apr 10, 2018 · 0 comments
Open

Create pytest fixtures for integration tests #143

jaraco opened this issue Apr 10, 2018 · 0 comments

Comments

@jaraco
Copy link
Owner

jaraco commented Apr 10, 2018

I imagine one could create a pytest fixture, one which starts the server and provides convenience functions for common assertions, such that a test could look something like:

def test_server_receives_message(irc_server):
    client = irc_server.get_client(nick=’test_user')
    client.pubmesg(“#test-channel”, “Hello message”)
    assert irc_server.get_last_message().nick == ‘test_user’
    assert irc_server.get_last_message().type == ‘pubmsg’
    assert irc_server.get_last_message().message_text.startswith(“Hello”)

Note, that is not a spec, but more of a sketch of the idea. The actual interface would need to use names and methods that match the spec/implementation.

The test would be exposed through entry points such that the mere presence of this irc library in the test environment would make that fixture available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant