class documentation

This is a mixin which adds an example to the path, tests it, and then removes it from the path and unimports the modules which the test loaded. Test cases which test example code and documentation listings should use this.

This is done this way so that examples can live in isolated path entries, next to the documentation, replete with their own plugin packages and whatever other metadata they need. Also, example code is a rare instance of it being valid to have multiple versions of the same code in the repository at once, rather than relying on version control, because documentation will often show the progression of a single piece of code as features are added to it, and we want to test each one.

Method setUp Add our example directory to the path and record which modules are currently loaded.
Method tearDown Remove the example directory from the path and remove all modules loaded by the test from sys.modules.
Method test_shebang The example scripts start with the standard shebang line.
Method test_usageConsistency The example script prints a usage message to stdout if it is passed a --help option and then exits.
Method test_usageConsistencyOnError The example script prints a usage message to stderr if it is passed unrecognized command line arguments.
Instance Variable example Undocumented
Instance Variable examplePath Undocumented
Instance Variable fakeErr Undocumented
Instance Variable fakeOut Undocumented
Instance Variable originalModules Undocumented
Instance Variable originalPath Undocumented
def setUp(self): (source)

Add our example directory to the path and record which modules are currently loaded.

def tearDown(self): (source)

Remove the example directory from the path and remove all modules loaded by the test from sys.modules.

def test_shebang(self): (source)

The example scripts start with the standard shebang line.

def test_usageConsistency(self): (source)

The example script prints a usage message to stdout if it is passed a --help option and then exits.

The first line should contain a USAGE summary, explaining the accepted command arguments.

def test_usageConsistencyOnError(self): (source)

The example script prints a usage message to stderr if it is passed unrecognized command line arguments.

The first line should contain a USAGE summary, explaining the accepted command arguments.

The last line should contain an ERROR summary, explaining that incorrect arguments were supplied.

Undocumented

examplePath = (source)

Undocumented

Undocumented

Undocumented

originalModules = (source)

Undocumented

originalPath = (source)

Undocumented