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 manuelpi.fakemodule

How to install manuelpi.fakemodule

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install manuelpi.fakemodule
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.1b1 Available View build log
Windows (64-bit)
0.1b1 Available View build log
Mac OS X (10.5+)
0.1b1 Available View build log
Linux (32-bit)
0.1b1 Available View build log
Linux (64-bit)
0.1b1 Available View build log
 
Author
License
ZPL 2.1
Dependencies
Lastest release
version 0.1b1 on Jan 5th, 2011

A plugin to enable the definition and usage of whole Python modules from within doctests.

Intro and Motivation

manuelpi.fakemodule is a plugin for Manuel that supports syntax for creating modules within a doctest. The module, once defined, is then usable by subsequent doctest statements.

This functionality is useful for packages that you might describe as being 'meta'; they operate on modules. Thus, being able to define and then process modules within the same doctest using a clean and uncluttered syntax is extremely beneficial.

One such package to benefit from this sort of facility is Martian, which scans modules for configuration directives, registering them as it goes.

Usage

The special REStructure Text directive:

'.. module-block:: <MODULE_NAME>'

is used to denote the start of a module and its alias <MODULE_NAME> for the rest of the doctest. We then define the module's body at a single indentation level after this directive. What follows is an example of a full doctest:

System Message: WARNING/2 (<string>, line 39)

Literal block expected; none found.

We create a new module with a main function to perform this task:

.. module-block:: test_module

import sys

class A: def do_something(self): return "Hello World"

def main(): print A().do_something()

Now let's execute the main function

>>> test_module.main()

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

Inconsistent literal block quoting.

Hello World

The above doctest creates a new module test_module and then exercises the objects within it. Notice how the module becomes immediately available to the doctet after its definition.

To use manualpi.fakemodule in your application, set up your tests as described in the Manuel documentation and import the Manuel class from manuelpi.fakemodule:

...

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

Inconsistent literal block quoting.

import manuelpi.fakemodule ... m += manuelpi.fakemodule.Manuel()

CHANGES

0.1b1 (2009-12-16)

  • Initial Public Release

Subscribe to package updates

Last updated Jan 5th, 2011

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.