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 https://codecov.io/gh/twosigma/marbles/branch/master/graph/badge.svg

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.4

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.4
File Size Uploaded
marbles-0.9.4.tar.gz 4.0 kB Details

Built distribution (wheel)

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

Total release size: 7.3 kB

Release files / marbles-0.9.4.tar.gz

Download URL marbles-0.9.4.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
42a13a22e17340d4fad9651de0d723d06978c7e7d6ad36c1a541c8cf6fe4f76c
BLAKE2b-256 checksum
How to use checksums
8f2289a16c201ffa7907d316959772fec3fd72e122e0f7adb02a5119103dc072
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

Download URL marbles-0.9.4-py2.py3-none-any.whl
Size 3.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
d76f9ac4f50247d3ee9f481058298542dd6850a975819b9cc2f79ebe88d27b53
BLAKE2b-256 checksum
How to use checksums
8794773190fdb748fe5a29ce112b1b66e7434b95dfb3894a3cbceb7305ad6f8b
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

This release

0.9.4 This release

2 release files

0.9.3

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