Skip to main content

Python testing for humans

Project description

Testsweet logo

Testsweet

Python testing for humans

Why?

Neither of the two most popular libraries for testing in Python, unittest and pytest, make it over the hurdle of the Zen of Python.

Beautiful is better than ugly.
Explicit is better than implicit.

unittest is modeled closely on JUnit and the xUnit family of libraries. Its strength is its familiarity to people who are accustomed to them. Its weakness is its failure to take advantage of existing Python idioms and conventions. It's not beautiful.

Pytest addresses a lot of the shortcomings of unittest, but the way that its fixtures work is magical, especially when they are imported invisibly. It doesn't make it past the second line of the Zen of Python.

Testsweet intends to be a Python testing library that uses existing Python features and idioms: A kind and simple interface, explicit in its architecture, enabling the tests that use it to be beautiful.

Examples

A test function:

from testsweet import test


@test
def or_dicts():
    assert {'foo': 1} | {'bar': 2} == {'foo': 1, 'bar': 2}

A test class:

from testsweet import test


@test
class OrThings:
    def or_dicts(self):
        assert {'foo': 1} | {'bar': 2} == {'foo': 1, 'bar': 2}

Running tests:

testsweet tests.test_module.TestClass.test_method
testsweet tests/test_module.py
testsweet  # Discover tests

python -m testsweet ... works equivalently and is useful when the console script is not on PATH.

Documentation

Project details


Download files

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

Source Distribution

testsweet-0.2.2.tar.gz (97.1 kB view details)

Uploaded Source

Built Distribution

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

testsweet-0.2.2-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file testsweet-0.2.2.tar.gz.

File metadata

  • Download URL: testsweet-0.2.2.tar.gz
  • Upload date:
  • Size: 97.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for testsweet-0.2.2.tar.gz
Algorithm Hash digest
SHA256 20129b6365c219bab03824fe53247a449143ca0963251a24116d00797617cd49
MD5 1d66108e006c724823253e6620bf2c9f
BLAKE2b-256 e9ecbd11560929df0b5f911144e00be59641791a2ad27df7a0e0eca3e70678fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for testsweet-0.2.2.tar.gz:

Publisher: publish.yml on kaapstorm/testsweet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file testsweet-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: testsweet-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for testsweet-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 102efae4e421fa8d7b9de48c6797b2006816265914b998b1f5f123764152eb6c
MD5 a830913395f5a53a00d5b44fb6e2ffa9
BLAKE2b-256 3ab6e573ca177232f59aa6a39aed66be93a977b66c3f87eb8e3d9cfb43d18e2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for testsweet-0.2.2-py3-none-any.whl:

Publisher: publish.yml on kaapstorm/testsweet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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