Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install ivoire

How to install ivoire

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install ivoire
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
0.1
0.2Never BuiltWhy not?
0.1 Available View build log
Linux (32-bit)
0.1
0.2Never BuiltWhy not?
0.1 Available View build log
0.1
0.2Never BuiltWhy not?
0.1 Available View build log
Linux (64-bit)
0.2 Available View build log
0.1 Available View build log
0.1
0.2Never BuiltWhy not?
0.1 Available View build log
0.2 Available View build log
 
Author
License
MIT/X
Lastest release
version 0.2 on Sep 20th, 2013
Travis CI Build Status

ivoire is an RSpec-like testing framework for Python. It aims to bring a few minor constructs over to Python in a way that isn't overwhelmingly disruptive or counterculture.

In case you've never heard of RSpec, it's a Ruby BDD framework that is fairly widely used, and whose tests have a style unique from xUnit's.

Installation

Ivoire is on PyPi and can be installed via pip install ivoire (or via your preferred installation method).

At this point you should consider Ivoire to be experimental, and there are likely plenty of bugs to address, so please file them as you run into them on the issue tracker.

A Small Example

To write specs using Ivoire, simply import and use ivoire.describe. You can then execute the spec using the included ivoire test runner.

Here's an example of what a specification looks like.

System Message: ERROR/3 (<string>, line 36)

Unknown directive type "code".

.. code:: python

    from ivoire import describe, context


    class Calculator(object):
        def add(self, x, y):
            return x + y

        def divide(self, x, y):
            return x / y


    with describe(Calculator) as it:
        @it.before
        def before(test):
            test.calc = Calculator()

        with it("adds two numbers") as test:
            test.assertEqual(test.calc.add(2, 4), 6)

        with it("multiplies two numbers") as test:
            test.assertEqual(test.calc.multiply(2, 3), 6)

        with context(Calculator.divide):
            with it("divides two numbers") as test:
                test.assertEqual(test.calc.divide(8, 4), 2)

            with it("doesn't divide by zero") as test:
                with test.assertRaises(ZeroDivisionError):
                    test.calc.divide(8, 0)


You can find this example at examples/calculator_spec.py, alongside a few others.

After installing Ivoire, running the example above with ivoire examples/calculator_spec.py should produce:

spec output

If you'd like a more verbose output, try passing the -v command line flag.

At some point in the (hopefully very near) future, when I've sorted out an import hook, Ivoire will also be able to be run as ivoire transform `which nosetests` --testmatch='(?:^|[\b_\./-])[Ss]pec', which will transform specs automatically into normal unittest.TestCases. Work on this is in progress.

Running the Test Suite

Ivoire's test suite is currently written mostly in itself, but it still has a small section that is written using the standard unittest test cases.

You can run Ivoire's test suite by running tox in the root of the repository checkout after installing tox via your package manager or with pip install tox. This will run both parts of the suite.

Contributing

I'm Julian Berman.

You can find me on Freenode in #python-testing and various other channels (nick: tos9) if you'd like to chat, or if there's enough interest in such a thing, in ##ivoire.

Ivoire is developed on GitHub.

Feel free to fork and submit patches or feature requests. Your contributions are most welcome!

If you'd like the best chance for them to be merged quickly try to include tests with your pull request, and adhere to general Python coding standards and your own common sense :).

Subscribe to package updates

Last updated Sep 20th, 2013

Download Stats

Last month:1

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.