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.3.tar.gz (48.8 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.3-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: testsweet-0.1.3.tar.gz
  • Upload date:
  • Size: 48.8 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.3.tar.gz
Algorithm Hash digest
SHA256 af7f26d75772adc749e0c9d51d62fb294e6937a5122b99cad84892bbb05b8d72
MD5 264392932da8c551e93a0c04539033e3
BLAKE2b-256 6bd1dde2b2ac9cffcacf8a1d4b55707f492540bbac35eca5c0d60cadcc1f4437

See more details on using hashes here.

File details

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

File metadata

  • Download URL: testsweet-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 15.6 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 ad76f0e4da1b740f33f1306b4eb45c4fafc4233749bee7db66c2e0ae549c312b
MD5 2a30cd2438cdc22e2f3ac060347f7c60
BLAKE2b-256 d37f5fcdb07154eca21ee633e8ca947a1da6e4718bf46a949ec9414a0f4ed6d0

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