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.1.tar.gz (96.7 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.1-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: testsweet-0.2.1.tar.gz
  • Upload date:
  • Size: 96.7 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.1.tar.gz
Algorithm Hash digest
SHA256 3fabd874e6fc9a429e441201afaab860574af14531bd57742aa3ef8356944cbf
MD5 f7e6f42c2ed3c83b980eabdc9bb8e5c5
BLAKE2b-256 e89eed51e687a3c27430195a4d080067b2adb5972996790c6d48d03aea787b42

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: testsweet-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 28.9 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef329f1f157f851491dee8e1107e9d371af395572e5538a0ed33645b44b552d0
MD5 0f207c2f301350b05df204d79f975b4f
BLAKE2b-256 70fe35baabaef706b2b687ed2c3d7fb05aaac795a9563d712a81dea0a6ffe41c

See more details on using hashes here.

Provenance

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