SWARD
Works just like Ward, but has some new fixes and features, since the original project was archived.
New features
- Ability to hide/show traceback locals, hence the name Sward — a silent Ward. 🤫
- Just use
ward test --hide-localsfor this purpose. - See: https://github.com/darrenburns/ward/issues/338
- Just use
Fixes
-
The traceback panel now uses the full terminal width (no more a small 100px box)
-
Breakpoint statements are working again
-
Event loop bugs fixed
Installation:
pip install sward
From now on, it's the same thing from Ward's original repo...
Ward is a Python testing framework with a focus on productivity and readability. It gives you the tools you need to write well-documented and scalable tests.
Features
See the full set of features in the documentation.
Descriptive test names: describe what your tests do using strings, not function names.
@test("simple addition") # you can use markdown in these descriptions!
def _():
assert 1 + 2 == 3 # you can use plain assert statements!
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 test selection: limit your test run not only by matching test names/descriptions, but also on the code contained in the body of the test.
ward --search "Database.get_all_users"
Or use tag expressions for more powerful filtering.
ward --tags "(unit or integration) and not slow"
Parameterised testing: write a test once, and run it multiple times with different inputs by writing it in a loop.
for lhs, rhs, res in [
(1, 1, 2),
(2, 3, 5),
]:
@test("simple addition")
def _(left=lhs, right=rhs, result=res):
assert left + right == result
Cross platform: Tested on Mac OS, Linux, and Windows.
Speedy: Ward's suite of ~320 tests run in less than half a second on my machine.
Zero config: Sensible defaults mean running ward with no arguments is enough to get started. Can be configured using pyproject.toml or the command line if required.
Extendable: Ward has a plugin system built with pluggy, the same framework used by pytest.
Colourful, human readable output: quickly pinpoint and fix issues with detailed output for failing tests.
Getting Started
Have a look at the documentation!
How to Contribute
Contributions are very welcome and encouraged!
See the contributing guide for information on how you can take part in the development of Ward.
Metadata
Release files for sward 0.70.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sward-0.70.2.tar.gz | 39.0 kB | Without provenance | Details for sward-0.70.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sward-0.70.2-py3-none-any.whl | Python 3 | none | any | Details for sward-0.70.2-py3-none-any.whl |
Total release size: 83.3 kB
Release files / sward-0.70.2.tar.gz
| Download URL | sward-0.70.2.tar.gz |
|---|---|
| Size | 39.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ad957ce6d6c0297f107f822493cbecc6f4f2e95a5ca045e28e949fc74a130a4
|
|
BLAKE2b-256 checksum How to use checksums |
576214f560e46fa8e9f19789212e2c4276f98c8ff20010729d3391b4858eda06
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.0 CPython/3.12.13 Linux/7.0.0-31-generic
|
Release files / sward-0.70.2-py3-none-any.whl
| Download URL | sward-0.70.2-py3-none-any.whl |
|---|---|
| Size | 44.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c108ce0bf977483f5265a413b1da1be2ecb823ae6a056d716b69a50cd0c0f579
|
|
BLAKE2b-256 checksum How to use checksums |
db9e02b694aa5886f40bae16a9939290bd1f0c534e4e3e3acf580f334d780a02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.0 CPython/3.12.13 Linux/7.0.0-31-generic
|
Security for sward 0.70.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.