Skip to main content
marbles.svg

marbles

https://img.shields.io/pypi/v/marbles.svg https://img.shields.io/travis/twosigma/marbles.svg Documentation Status

Read better test failures.

Overview

marbles is a Python unittest extension that allows test authors to write richer tests that expose more information on test failure to help you debug failing tests faster.

  • Treat test failures as documentation

  • Contextualize failures without digging through test code and dropping debugging statements everywhere

  • Write clearer, more explicit tests

Features

  • Drop-in unittest replacement

  • Information-rich failure messages

    • The full statement that failed (instead of just the last line)

    • Local variables in scope at the time the test failed

    • Optional annotation provided by the test author with details about the test

    • Ability to toggle traceback

  • Semantically-rich assertion methods

  • Assertion logging

Demo

You can run the example tests provided to see what a marbles failure message looks like

python -m marbles docs/examples/getting_started.py
F
======================================================================
FAIL: test_create_resource (docs.examples.getting_started.ResponseTestCase)
----------------------------------------------------------------------
marbles.core.marbles.ContextualAssertionError: 409 != 201

Source (/path/to/docs/examples/getting_started.py):
     39 res = requests.put(endpoint, data=data)
 >   40 self.assertEqual(
     41     res.status_code,
     42     201
     43 )
Locals:
        endpoint=http://example.com/api/v1/resource
        data={'name': 'Little Bobby Tables', 'id': 1}


----------------------------------------------------------------------
Ran 1 test in 0.002s

FAILED (failures=1)

You can also run your existing unittest tests with marbles

python -m marbles test_module.py

Installing

pip install marbles

Release files for marbles 0.9.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for marbles 0.9.3
File Size Uploaded
marbles-0.9.3.tar.gz 3.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for marbles 0.9.3
File Interpreter ABI Platform
marbles-0.9.3-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 7.2 kB

Release files / marbles-0.9.3.tar.gz

Download URL marbles-0.9.3.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
213a82362e57de78f5116a3c6963a7dd6d2d3b011ce9e972adddcc9ed222b602
BLAKE2b-256 checksum
How to use checksums
4f4319ba1ec2003c6a0b668bda9f01733fc797fd859f3a9a1ca69ea69616ec12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / marbles-0.9.3-py2.py3-none-any.whl

Download URL marbles-0.9.3-py2.py3-none-any.whl
Size 3.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
17e4b84dfe72ea032d0d8e3f289e1d18392e8e3988bad1cc08547441fa9f879f
BLAKE2b-256 checksum
How to use checksums
ec9fbb061a946283b12b458357ccc85fb1c0723afd90108b774f0ae984465721
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.12.3

2 release files

0.12.2

2 release files

0.11.0

2 release files

0.10.0

2 release files

0.9.5

2 release files

0.9.4

2 release files

This release

0.9.3 This release

2 release files

0.9.2

2 release files

0.9.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page