Skip to main content

A Framework for Behavior Driven Development(BDD) based on stdlib's unittest

Project description

It is inspired from Ruby’s RSpec. Spec definition is based on Python decorator description.


  • Python decorator based “Spec” definition
  • “Spec” definition is compatible with unittest.TestCase
  • Spec files can execute with unittest or nosetests
  • RSpec like Expectation (e.g. the[xxx][yyy])
  • Decorator based “Mock” object definition
  • All features can be used independently: e.g. use spec with
  • Markdown document generator from spec file
  • Single code implementation for multi python version (2.5-2.7, 3.1)

Spec Example

# examples/
from specfor import the, spec

empty_list = spec.of("empty list")
int_list = spec.of("int list")

def prepare(its):
    its.list = []
    its.sum = 0

def prepare(its):
    its.list = [2, 3, 5, 7, 11]
    its.sum = 28

def sum_spec(its):
    result = sum(its.list)
    the[result].should == its.sum


For more detail, see

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

python-specfor-0.1.0.tar.gz (23.0 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page