<?xml version="1.0" ?>
<?xml-stylesheet type='text/xsl' href='interface.xsl'?>
<interface uri="http://gfxmonk.net/dist/0install/python-pea.xml" xmlns="http://zero-install.sourceforge.net/2004/injector/interface">
	<name>python-pea</name>
	<summary>minimal BDD library for python</summary>
	<description>
pea - The tiniest green vegetable.
-------------------------------------

**pea** is a minimal BDD framework for python, in the style of ruby's `cucumber`_ and
python's `lettuce`_. It aims to help you write the same kind of tests - but in straight-up
python code, without all the parsing and indirection and other hoops to jump through. It's
a lot like ruby's `coulda`_.

Benefits of cucumber-style testing include:

- You write your tests in clear, english language without inline code
- Your tests are human-readable, and hopefully human-editable
- You can re-use steps with confidence, because they all do exactly what
  they say on the tin

Benefits of ``pea`` over ``lettuce``, ``cucumber``, etc:

- It's a really trivial library (thus the name). It doesn't do very much,
  so it probably doesn't have many bugs
  
- Your features are just python code:
  
  - No &quot;BDD language parser&quot; needed
  - No regular expressions
  - Stack traces make sense
  - Syntax highlighting
  - You can use `ctags`_ to jump between test &amp; implementation, as well as
    for method completion
  - Managing and renaming functions is much easier than managing regexes
  - You can use whatever abstractions you like
  - You can use rich python objects as arguments, instead of parsing strings
     
- It doesn't need its own test runner; so you can just use `nose`_ to run it
  alongside your unit tests


So how do I use it?
--------------------------------------

Here's a minimal example::

	from pea import *

	@step
	def I_go_to_the_store():
		world.location='store'
		world.cart = []
	
	@step
	def I_buy_some(item):
		world.cart.append(item)

	@step
	def I_go_home():
		world.location = 'home'
	
	@step
	def I_have_some_delicious(item):
		assert item in world.cart
		world.assertEquals(world.location, 'home')

	# --------------------

	class TestShopping(TestCase):
		def test_buying_some_peas(self):
			
			Given.I_go_to_the_store()
			When.I_buy_some('peas')
			And.I_go_home()
			Then.I_have_some_delicious('peas')

... and when you run it (with nosetests, in verbose mode):

.. image:: http://gfxmonk.net/dist/0install/pea/screenshot.png

Typically you would put your steps in a separate python module (or many),
but it's your choice.

Basics:
^^^^^^^

- ``@step`` adds your function to pea's registry of steps, which allows
  them to be called via ``Given``, ``When``, ``And``, and ``Then``.
- To re-use a step from inside another step, just call the function!

Stuff to remember:
^^^^^^^^^^^^^^^^^^
- Make sure you inherit from ``pea.TestCase`` (and call ``super`` from ``setUp``/``tearDown``),
  as it takes care of resetting the ``world`` between tests.
- You can use ``TestCase`` assertion methods on the world, too
  - e.g. ``world.assertEquals(expected, actual)``

Pea works well with `rednose`_

.. _cucumber: http://cukes.info/
.. _coulda: https://github.com/elight/coulda
.. _lettuce: https://github.com/gabrielfalcao/lettuce/
.. _ctags: http://ctags.sourceforge.net/
.. _nose: http://somethingaboutorange.com/mrl/projects/nose/1.0.0/
.. _rednose: https://github.com/gfxmonk/rednose/tree
	</description>
	<rich-description xmlns="http://gfxmonk.net/dist/0install">
		<div xmlns="http://www.w3.org/1999/xhtml">
			<h1 id="pea---the-tiniest-green-vegetable.">pea - The tiniest green vegetable.</h1>
			<p><strong>pea</strong> is a minimal BDD framework for python, in the style of ruby's <a href="http://cukes.info/">cucumber</a> and python's <a href="https://github.com/gabrielfalcao/lettuce/">lettuce</a>. It aims to help you write the same kind of tests - but in straight-up python code, without all the parsing and indirection and other hoops to jump through. It's a lot like ruby's <a href="https://github.com/elight/coulda">coulda</a>.</p>
			<p>Benefits of cucumber-style testing include:</p>
			<ul>
				<li>You write your tests in clear, english language without inline code</li>
				<li>Your tests are human-readable, and hopefully human-editable</li>
				<li>You can re-use steps with confidence, because they all do exactly what they say on the tin</li>
			</ul>
			<p>Benefits of <code>pea</code> over <code>lettuce</code>, <code>cucumber</code>, etc:</p>
			<ul>
				<li>
					<p>It's a really trivial library (thus the name). It doesn't do very much, so it probably doesn't have many bugs</p>
				</li>
				<li>
					<p>Your features are just python code:</p>
					<ul>
						<li>No &quot;BDD language parser&quot; needed</li>
						<li>No regular expressions</li>
						<li>Stack traces make sense</li>
						<li>Syntax highlighting</li>
						<li>You can use <a href="http://ctags.sourceforge.net/">ctags</a> to jump between test &amp; implementation, as well as for method completion</li>
						<li>Managing and renaming functions is much easier than managing regexes</li>
						<li>You can use whatever abstractions you like</li>
						<li>You can use rich python objects as arguments, instead of parsing strings</li>
					</ul>
				</li>
				<li>
					<p>It doesn't need its own test runner; so you can just use <a href="http://somethingaboutorange.com/mrl/projects/nose/1.0.0/">nose</a> to run it alongside your unit tests</p>
				</li>
			</ul>
			<h1 id="so-how-do-i-use-it">So how do I use it?</h1>
			<p>Here's a minimal example:</p>
			<pre><code>from pea import *

@step
def I_go_to_the_store():
    world.location='store'
    world.cart = []

@step
def I_buy_some(item):
    world.cart.append(item)

@step
def I_go_home():
    world.location = 'home'

@step
def I_have_some_delicious(item):
    assert item in world.cart
    world.assertEquals(world.location, 'home')

# --------------------

class TestShopping(TestCase):
    def test_buying_some_peas(self):

        Given.I_go_to_the_store()
        When.I_buy_some('peas')
        And.I_go_home()
        Then.I_have_some_delicious('peas')
</code></pre>
			<p>... and when you run it (with nosetests, in verbose mode):</p>
			<img alt="image" src="http://gfxmonk.net/dist/0install/pea/screenshot.png"/>
			<p>Typically you would put your steps in a separate python module (or many), but it's your choice.</p>
			<h2 id="basics">Basics:</h2>
			<ul>
				<li><code>@step</code> adds your function to pea's registry of steps, which allows them to be called via <code>Given</code>, <code>When</code>, <code>And</code>, and <code>Then</code>.</li>
				<li>To re-use a step from inside another step, just call the function!</li>
			</ul>
			<h2 id="stuff-to-remember">Stuff to remember:</h2>
			<ul>
				<li>Make sure you inherit from <code>pea.TestCase</code> (and call <code>super</code> from <code>setUp</code>/<code>tearDown</code>), as it takes care of resetting the <code>world</code> between tests.</li>
				<li>You can use <code>TestCase</code> assertion methods on the world, too<ul><li>e.g. <code>world.assertEquals(expected, actual)</code></li></ul></li>
			</ul>
			<p>Pea works well with <a href="https://github.com/gfxmonk/rednose/tree">rednose</a></p>
		</div>
	</rich-description>
	<group>
		<command name="run">
			<runner interface="http://gfxmonk.net/dist/0install/nosetests-plugin-resolver.xml"/>
		</command>
		<command name="test" path=".">
			<requires interface="http://gfxmonk.net/dist/0install/rednose.xml"/>
			<runner interface="http://gfxmonk.net/dist/0install/nosetests-plugin-resolver.xml"/>
		</command>
		<environment mode="prepend" name="NOSETESTS_PLUGINS" value="pea/PeaFormatter"/>
		<environment insert="" mode="prepend" name="PYTHONPATH"/>
		<implementation id="sha1new=eef73fda258ffb1f76588ba12aae6bee0812e355" released="2011-01-30" version="0.1">
			<manifest-digest sha256="4d18a8e38749b3f4b3a9ad5f217ae69233864f331f650ae8e583e86fa7a0af1f"/>
			<archive href="http://gfxmonk.net/dist/0install/python-pea/python-pea-0.1.tgz" size="4370"/>
		</implementation>
		<implementation id="sha1new=ebfcaa607f3568d3f9d852462e99f2245bedacac" released="2011-05-02" version="0.1.1">
    <manifest-digest sha256="f0f0ecc66b9bac2121e732f1c8151e82c1455cf71f3a4c8b564911ecd8005c6a"/>
    <archive href="http://gfxmonk.net/dist/0install/python-pea/python-pea-0.1.1.tgz" size="4410"/>
  </implementation>
	</group>
</interface>
<!-- Base64 Signature
iEYEABECAAYFAk2+lLoACgkQ/lhgK1iJTtI4kgCeMhj1eS0XlaiXBrWsDo9G6g5EwugAniR+LCcn
JWFn7cBkzdYV56qO689x

-->

