A test framework for Python with a focus on productivity and readability
Ward
Ward is a modern test framework for Python with a focus on productivity and readability.
Features
Descriptive test names: describe what your tests do using strings, not function names.
@test("1 + 2 == 3")
def _():
assert 1 + 2 == 3
Modular test dependencies: manage test setup/teardown code using fixtures that rely on Python’s import system, not name matching.
@fixture
def user():
return User(name="darren")
@test("the user is called darren")
def _(u=user):
assert u.name == "darren"
Support for asyncio: define your tests and fixtures with async def
and call asynchronous code within them.
@fixture
async def user():
u = await create_user()
return await u.login()
@test("the logged in user has a last session date")
async def _(user=user):
last_session = await get_last_session_date(user.id)
assert is_recent(last_session, get_last_session_date)
Powerful