Cram is a functional testing framework for command line applications based on Mercurial's unified test format. Cram tests look like snippets of interactive shell sessions. Cram runs each command and compares the command output in the test with the command's actual output. Here's a snippet from Cram's own test suite: The $PYTHON environment variable should be set when running this test from Python.