Skip to main content

Python testing for humans

Project description

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.4.tar.gz (51.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.1.4-py3-none-any.whl (17.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: testsweet-0.1.4.tar.gz
  • Upload date:
  • Size: 51.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"openSUSE Tumbleweed","version":"20260422","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for testsweet-0.1.4.tar.gz
Algorithm Hash digest
SHA256 f24988f9402089518310610d731f0870cb3df4c0747ac1478223c863ecdf9216
MD5 fa0d94f4baf80bae5c1424577aad6380
BLAKE2b-256 b92b48cb60153ea397dd48b73c857b8839ce92d2bd6b81eb471e1ff96a65354e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: testsweet-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 17.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"openSUSE Tumbleweed","version":"20260422","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for testsweet-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a92324de7272c4463a339b004e1f84b4d2ff0488e652f773c93af27c809f4843
MD5 7a1f8db187873bc859116fb741b155b1
BLAKE2b-256 dbe3e1e92bf18ca4ec9121640ff20f4cf47027b297c9bc07778237cebb7f5492

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