Skip to main content

red / green / refactor

Build Status

A currently experimental attempt at an RSpec-esque BDD testing framework for Python.

Basically we’re aiming for syntax along these lines:

from rgf import describe, it

with describe("That Thing"):
    @it("test desc")
    def spec(context):
        # test code here
        assert stuff()

x_spec.py files go in a directory structure under, by convention, spec/ in the root of your project and are run using:

rgf spec

The specifics of the syntax are currently wrong, being borrowed directly from RSpec. Suggestions warmly received.

(Current front-runners are subject and context in place of describe, keeping it for the spec decorator.)

Because the spec functions are just functions, not methods, and are hoovered up by the @it decorator they’re effectively anonymous and can all have the same name for ease of thinking:

with subject('This Class'):
    @it('can calculate X')
    def s(world):
        pass

    @it('can account for Y')
    def s(world):
        pass

The aim is for something pythonic, with nested context and good spec names being the primary focus: minimum magic, minimum fuss.

Changelog

0.2.0.1 (2012-05-19)

  • bump to update the Changelog, which I had neglected to do for 0.2.0 (sorry)

0.2.0 (2012-05-18)

  • Python 3 support, courtesy of Marc Abramowitz

  • create rgf and rgf-x.y scripts using distribute

  • ExampleGroups can be nested using with describe():

0.0.2 (2012-05-13)

  • Anonymous module collection of specs using randomly-generated module names. (fixes problems with imports of specs related to polluting sys.modules)

0.0.1 (2012-05-12)

The so-how-does-pypi-work-then? release.

Metadata

Release files for rgf 0.2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rgf 0.2.0.1
File Size Uploaded
rgf-0.2.0.1.tar.gz 5.9 kB Details

Release files / rgf-0.2.0.1.tar.gz

Download URL rgf-0.2.0.1.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
66c4395e441dcb756fe64675579c207d95c1748ac2b0048d601dcec156c954e1
BLAKE2b-256 checksum
How to use checksums
5159da2ef46a1e04a731e9babb7b2aeed1c73cb98e7da44e06f46758f37b8b50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.0.1 This release

1 release file

0.2.0

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page