Skip to main content

A BDD-like test framework

Project description

# Specpy

A [rspec](http://rspec.info/) inspired BDD-like testing framework


# How to use it

Install it from pip with

```bash
pip install specpy
```

Your specs must have the prefix 'spec_' and each spec function must have the decorator 'spec'

# Example

```python
# calculator.py
class Calculator:
def __init__(self):
pass

def add(self, a, b):
return a + b


# specs/spec_calculator.py

from calculator import Calculator
from specpy import *


@spec
def calculator():
with describe('Calculator'):
with context('using only integer as paramters'):
c = Calculator()
with describe('#add'):
with it('should return 3'):
should(c.add(1, 2)).be.equals_to(3)
with it('should not return 3'):
should(c.add(1, 2)).not_be.equals_to(3) # fails
with it('should not return 3'):
should(c.add(1, 3)).not_be.equals_to(3)
```

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

specpie-1.1.3.post1.tar.gz (2.7 kB view hashes)

Uploaded Source

Built Distribution

specpie-1.1.3.post1-py3-none-any.whl (7.2 kB view hashes)

Uploaded Python 3

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