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.0.tar.gz (111.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.0-py3-none-any.whl (28.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: testsweet-0.2.0.tar.gz
  • Upload date:
  • Size: 111.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.0.tar.gz
Algorithm Hash digest
SHA256 a4c270f861bde1099b855e850e35e695e85f688bf12504c1083737d0d3668838
MD5 7a3d22050974f5943fd75e92b0306e95
BLAKE2b-256 44f29887dfe4686a5b27a178cada29df35b2ef076c2724f3aca2c7aac40dd026

See more details on using hashes here.

Provenance

The following attestation bundles were made for testsweet-0.2.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: testsweet-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 28.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 04148a7e65962529c2994f58fde1e8d9f997b69793e56e50294fa267303459fd
MD5 238cad497c8af60a5bf057b2e377b1e6
BLAKE2b-256 763cd0c7ffd3f4e702cf304de58284a571fff26f3dc1f4eecd3cb0988cfcc86a

See more details on using hashes here.

Provenance

The following attestation bundles were made for testsweet-0.2.0-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