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:

python -m testsweet tests.test_module.TestClass.test_method
python -m testsweet tests/test_module.py
python -m testsweet  # Discover tests

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.2.tar.gz (48.4 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.2-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: testsweet-0.1.2.tar.gz
  • Upload date:
  • Size: 48.4 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.2.tar.gz
Algorithm Hash digest
SHA256 daffd8b136322eb3d688d7338532ab77927f923add4dc66aab409f4100cd5b46
MD5 ad1aa283d7d5d0257f6c4611ae6ee1f4
BLAKE2b-256 5d2bd55807f9eaf049d502e050f1509905ab2c88018d63d3568af9ec8435a172

See more details on using hashes here.

File details

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

File metadata

  • Download URL: testsweet-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c222e91ab4d9293441bd894018fdafeebc7cbc842afbb32b78d18a5af6beb84e
MD5 35230bbe02ffcd7f66f162005f731998
BLAKE2b-256 f7fe4b9173c2743226c26cd3e4a4e4dea9401a655f52ce3027121352b0da267b

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