Need help with mamba?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

nestorsalceda
476 Stars 65 Forks MIT License 468 Commits 52 Opened issues

Description

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

Services available

!
?

Need anything else?

Contributors list

# 18,578
helm
Kuberne...
ibm-blu...
Shell
325 commits
# 457,638
Python
31 commits
# 238,524
Go
Shell
rabbitm...
amqp
13 commits
# 305,545
Clojure
Shell
CSS
deseria...
10 commits
# 482,364
Python
4 commits
# 155,787
Kuberne...
ibm-blu...
Shell
HTML
3 commits
# 410,624
HTML
CSS
Shell
Qt
2 commits
# 31,292
Ruby
CSS
ruby-ge...
GitHub ...
2 commits
# 26,201
nodemai...
email-s...
Perl
TypeScr...
2 commits
# 297,490
R
Shell
lita
HTML
2 commits
# 78,075
Perl
Common ...
session...
mediain...
1 commit
# 633,664
Python
1 commit
# 120,498
crowdso...
C
CSS
oauth2
1 commit
# 22,670
JavaFX
CSS
HTML
transla...
1 commit

mamba: the definitive test runner for Python

Build Status Latest PyPI Version Read The Docs Status PyPI pyversions

mamba is the definitive test runner for Python. Born under the banner of behavior-driven development.

Install

I recommend to use pipenv for managing your dependencies, thus you can install mamba like any other Python package.

By example:

  $ pipenv install mamba

But you also can use pip:

  $ pip install mamba

Getting Started

Write a very simple example that describes your code behaviour:

  # tennis_spec.py

from mamba import description, context, it from expects import expect, equal

with description('Tennis') as self: with it('starts with 0 - 0 score'): rafa_nadal = "Rafa Nadal" roger_federer = "Roger Federer" game = Game(rafa_nadal, roger_federer)

  expect(game.score()).to(equal((0, 0)))

Run the example, and don't forget to watch it fail!

  $ pipenv run mamba tennis_spec.py

F

1 examples failed of 1 ran in 0.0023 seconds

Failures:

1) Tennis it starts with 0 - 0 score
  Failure/Error: tennis_spec.py game = Game(rafa_nadal, roger_federer)
      NameError: global name 'Game' is not defined

  File "tennis_spec.py", line 8, in 00000001__it starts with 0 - 0 score--
      game = Game(rafa_nadal, roger_federer)

Now write as little code for making it pass.

  # tennis_spec.py

from mamba import description, context, it from expects import expect, equal

import tennis

with description('Tennis') as self: with it('starts with 0 - 0 score'): rafa_nadal = "Rafa Nadal" roger_federer = "Roger Federer" game = tennis.Game(rafa_nadal, roger_federer)

  expect(game.score()).to(equal((0, 0)))

  # tennis.py

class Game(object): def init(self, player1, player2): pass

def score(self):
  return (0, 0)

Run the spec file and enjoy that all tests are green!

  $ pipenv run mamba tennis_spec.py

.

1 examples ran in 0.0022 seconds

Settings

Mamba provides a way to configuration using

spec/spec_helper.py
or
specs/spec_helper.py
This module function is read after parsing arguments so configure function overrides settings

A sample config file :

def configure(settings):
  # settings.slow_test_threshold = 0.075
  # settings.enable_code_coverage = False
  # settings.code_coverage_file = '.coverage'
  settings.format = 'documentation'
  # settings.no_color = False
  # settings.tags = None

Official Manual

You can read more features about mamba in its official manual

Contributors

Here's a list of all the people who have contributed.

I'm really grateful to each and every of them!

If you want to be one of them, fork repository and send a pull request.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.