atelier.sheller

Defines the Sheller class for testing bash commands in a doctest.

Others have invented similar things before. For example doctest2 by Devin Jeanpierre. Another alternative is Clatter by Michael Delgado.

Classes

Sheller([cwd])

A sheller is a little helper object to be used in tested documents for running shell commands and testing their output.

class atelier.sheller.Sheller(cwd=None)

Bases: object

A sheller is a little helper object to be used in tested documents for running shell commands and testing their output.

When instantiating a Sheller, you can optionally give a single argument, which is the directory where the commands will run. When you don’t specify a directory, Sheller creates a temporary directory and has all processes run there.

Usage example:

>>> import os
>>> from atelier.sheller import Sheller
>>> shell = Sheller(os.path.dirname(__file__))
>>> shell('ls -S *.py')  
projects.py
test.py
jarbuilder.py
sheller.py
setup_info.py
sphinxconf.py
utils.py
__init__.py

In case you wonder: We sort the by size because that’s reproducible. Seems that some locales put underscores before letters while others don’t.