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.1.5.tar.gz (91.0 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.1.5-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for testsweet-0.1.5.tar.gz
Algorithm Hash digest
SHA256 6c4b05abf1b9adf30ae631d21c8d06adbdc92ea50d7b4c9c101d7c005d9323b5
MD5 b0f3289d959b7b42b590caff438eaed8
BLAKE2b-256 cd1376b290a62d6788e74d111819d47c9fe6578d19acd6f310d039921961ffde

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: testsweet-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 18.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.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 044d061c970ca06ceb5d5fcde0acc73370e6192c387350e1de9891f480fe34c8
MD5 12168fe824031ce3677b280d3daa16d5
BLAKE2b-256 7b864264e4ee9983e33fc5db58808cb2d0e03cd1232ed5c768a810badaf36fc4

See more details on using hashes here.

Provenance

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