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

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

Built distribution (wheel)

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

Total release size: 7.3 kB

Release files / marbles-0.9.5.tar.gz

Download URL marbles-0.9.5.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
dfdd7b9959b778c797862845d251c7ff9ef6fa19e51d2389209c9b8fc9fbad3f
BLAKE2b-256 checksum
How to use checksums
43c27d6b5140a74ae7c10cf7e8fbd0f812df783eeafab5be6acda46710159316
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

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

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

This release

0.9.5 This release

2 release files

0.9.4

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