Skip to main content

A modern Python 3 test framework for finding and fixing flaws faster.

Project description

Ward

PyPI version All Contributors

See the full documentation and feature set here.

A modern Python test framework designed to help you find and fix flaws faster.

Features

Descriptive test names: describe what your tests do using strings, not function names.

@test("1 + 2 gives 3")
def _():
    expect(1 + 2).equals(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):
    expect(u.name).equals("darren")

Fast, minimal overhead: roughly half the test run overhead of pytest.

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"

Parameterised testing: write a test once, and call it multiple times with different inputs

@test("truncate('{text}', num_chars={num_chars}) returns '{expected}'")
def _(
    text=s,
    num_chars=each(20, 11, 10, 5),
    expected=each(s, s, "hello w...", "he..."),
):
    result = truncate(text, num_chars)
    expect(result).equals(expected)

Expect API: A simple but powerful assertion API inspired by Jest.

Cross platform: Tested on Mac OS, Linux, and Windows.

Zero config: Sensible defaults mean running ward with no arguments is enough to get started.

Colourful, human readable output: quickly pinpoint and fix issues with detailed output for failing tests. screenshot

This project is currently in beta.

Planned features:

  • Smart test execution order designed to surface failures faster (using various heuristics)
  • Multi-process mode to improve performance
  • Highly configurable output modes
  • Code coverage with --coverage flag
  • Handling flaky tests with test-specific retries, timeouts
  • Plugin system

Let me know if you'd like to help out with any of these features!

Getting Started

Take a look at the "Getting Started" tutorial.

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.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Darren Burns
Darren Burns

💻 📖 🤔 👀 🐛 💡
khusrokarim
khusrokarim

🤔 💻 🐛
Alec Jordan
Alec Jordan

💻
Jason C. McDonald
Jason C. McDonald

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ward-0.26.0b0.tar.gz (708.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ward-0.26.0b0-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file ward-0.26.0b0.tar.gz.

File metadata

  • Download URL: ward-0.26.0b0.tar.gz
  • Upload date:
  • Size: 708.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.22.0

File hashes

Hashes for ward-0.26.0b0.tar.gz
Algorithm Hash digest
SHA256 d2330cf722a4e546e66ec674df35c61fc602511a0d39e3818160fcd4d6e07b14
MD5 948077e7f476441240f54175e42e1ae2
BLAKE2b-256 bd7acf4a7df29e69038bf557f04250e0d733e21956107e8d1ebb0e7b4431778b

See more details on using hashes here.

File details

Details for the file ward-0.26.0b0-py3-none-any.whl.

File metadata

  • Download URL: ward-0.26.0b0-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.22.0

File hashes

Hashes for ward-0.26.0b0-py3-none-any.whl
Algorithm Hash digest
SHA256 321c34fd1798323024eb1737d28e863be895df39811882b184a89ed12ec2ee0f
MD5 e8d56705ce3c29cc48bf855830efb22c
BLAKE2b-256 eaf18bef08a18d62ccbd824fcf913a1779b1ca7d439d59ed6f65e31ef25a8bfd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page