Python testing for humans.
Switch branches/tags
Nothing to show
Clone or download
Latest commit b45f23e Nov 8, 2017
Failed to load latest commit information.
pspec Put CWD at start of sys.path Jun 25, 2013
spec Rewritten to use Attest so it can build on existing work. No need to … Dec 30, 2012
.gitignore Ignore build and dist May 29, 2013
.travis.yml We don't support Python 2.5 Dec 30, 2012
LICENSE Initial commit Jun 20, 2012 Add May 29, 2013 Update Mocha link Nov 11, 2017
requirements.txt Install Attest 0.6 using dependency_links May 29, 2013 Version 0.0.2 Jun 25, 2013


Build Status

Python testing for humans, built with Attest.

Tests shouldn't just be for computers to check your code runs correctly. They can also be used by humans to understand what your code does.

pspec tests are designed to be parsed by humans. They look a bit like this:

from pspec import describe, assert_raises
import random

with describe('random'):
    with describe('shuffle'):
        def it_does_not_lose_any_elements():
            seq = range(10)
            assert seq == range(10)

        def it_raises_an_exception_for_an_immutable_sequence():
            with assert_raises(TypeError):
                random.shuffle((1, 2, 3))

    with describe('choice'):
        def it_picks_an_element_that_is_in_the_sequence():
            seq = range(10)
            assert random.choice(seq) in seq

(Compare with a similar example for the built-in unittest module.)

They are run with the pspec command:

$ pspec random_spec

Development install

$ pip install -r requirements.txt
$ python develop

Test suite

$ pspec spec


Note: pspec is still in its infancy. Don't expect it to be useful yet.

Here's some stuff I want it to do:

  • Beautiful test reports with coloured string diffs. (Similar to Mocha's)
  • Contexts, before/after hooks, etc.

It's going to be simple, Pythonic and use minimal magic.