Skip to main content

The definitive testing tool for Python. Born under the banner of Behavior Driven Development.

Project description

#mamba: the definitive testing tool for Python

[![Build Status](](

mamba is the definitive BDD testing framework for Python. Born under the banner of Behavior Driven Development.


To install mamba, just:

``` sh
pip install mamba


# Importing mamba is not needed!
# import mamba

with description('mamba'):
with it('is tested with mamba itself'):

with it('supports python 3'):


with context('when listing features'):
with it('supports example groups'):

with context('hooks'):
with before.all:
print 'This code will be run once, before all examples'

with before.each:
print 'This code will be run before each example'

with after.each:
print 'This code will be run after each example'

with after.all:
print 'This code will be run once, after all examples'

with context('pending tests'):
with _context('when running pending contexts (marked with a underscore)'):
with it('will not run any spec under a pending context'):

with _it('will not run pending specs (marked with underscore)'):

with it('highlights slow tests'):

with context(ASampleClass):
with it('has an instance in subject property'):

with context('when writing assertions'):
with it('can be used with plain assertions'):
assert True

with it('can be used with hamcrest style assertions'):
assert_that(True, is_(True))

with it('can be used with should_dsl style assertions'):
True |should| be(True)

with it('can be used with sure style assertions'):


with it('is assertion framework agnostic'):

with context('when using tests doubles'):
with it('can be used with mockito'):
stub = mock()


with it('can be used with doublex'):
with Spy() as sender:

assert_that(sender.is_usable_with_doublex(), is_(True))
assert_that(sender.is_usable_with_doublex, called())

with it('can be used with mock'):
is_usable_with_mock = Mock(return_value=True)

assert mock()

with it('is test doubles framework agnostic'):



If you'd like to contribute, fork [repository](, and send a pull request.

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

mamba-0.8.2.tar.gz (13.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page