Skip to content
This repository was archived by the owner on Sep 7, 2018. It is now read-only.

Testing

Daniel Däschle edited this page Feb 13, 2018 · 2 revisions

If you want to build good apps you maybe want to write software tests. Swapy also provide a module for making software tests easier.

For common unit tests you can do it like in the following example:

app.py

import swapy

# your stuff...

application = swapy.app()

main_test.py

from swapy.testing import client
from app import application  # Your app

c = client(application)

def test_works():
    r = c.get('/')
    assert r.status_code == 200

Then you can run pytest in your console. It automatically detects your test functions.

Happy testing :)

Clone this wiki locally