Skip to main content

install nosetests and plugins to ease bdd unit specs

Project description

SpecLoud

Use nosetests and plugins to take BDD specifications easier.

Installation

The easiest way to install specloud is using pip and requirements file:

$ pip install --no-deps specloud -r http://github.com/hugobr/specloud/raw/master/requirements.txt

Or you can try finding dependencies by yourself and installing specloud without requirements file.

Usage

Get a python file with BDD-style test names (starting with it, ensure, should, must, spec, example) and add them to the test suite

For example:

$ cat example.py

import unittest


class CalculatorSpec(unittest.TestCase):

    def it_should_sum_integers(self):
        # ...
        pass

    def should_not_divide_by_zero(self):
        # ...
        pass

    def must_accept_floats(self):
        # ...
        pass

    def ensure_it_work_with_fractions(self):
        # ...
        pass

    def test_subtract_positive_from_negative_numbers(self):
        # ...
        pass

The command line tool specloud colorizes green for tests with no failures and no errors and red for tests with failures and/or errors:

$ specloud example.py

Calculator spec
- ensure it work with fractions
- it should sum integers
- must accept floats
- should not divide by zero
- subtract positive from negative numbers

----------------------------------------------------------------------
Ran 5 tests in 0.003s

OK

How It Works

SpecLoud is a python package that install nose, pinocchio and figleaf packages, so it can call nosetests with pinocchio and figleaf plugins. nosetests is called with some default options to find test methods and pinocchio to show pretty and colored messages. figleaf is just pinocchio dependency.

A call to:

$ specloud FILE

is the same doing:

$ nosetests -i '^(it|ensure|must|should|specs?|examples?)' -i '(specs?(.py)?|examples?(.py)?)$' '--with-spec' '--spec-color'

Old Name

The project was born as a proof of concept and I named it firstly pyunitbdd. But that’s a terrible name. So I renamed the project to specloud.

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

specloud-0.3.1.tar.gz (3.4 kB view details)

Uploaded Source

File details

Details for the file specloud-0.3.1.tar.gz.

File metadata

  • Download URL: specloud-0.3.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for specloud-0.3.1.tar.gz
Algorithm Hash digest
SHA256 0273a9cd6f74099d94e1b6432972c1fdadd3118d24512b3d94edd6a9114d545b
MD5 65fc6ac2b58ea7e34d343254abb222c3
BLAKE2b-256 ad6a5dcd58aeb63b0d4b0a8daeb2cb603ba2c0ecbb3aa1e349167b17dae03a41

See more details on using hashes here.

Supported by

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