autotest/autotest — pull request #782 by rbbratta (2014-01-03 00:37:31+00:00)
Title: file_module_loader: add module importer for regular files

This uses the `imp.load_module` function to load any filename as a python
module. The filename does not have to end in *.py. This use case is
slightly complicated since Python will write bytecode files by default.
For example, if we use imp.load_module to load a file named "foo",
Python will write the bytecode to "fooc". This function works around
that by setting sys.dont_write_bytecode when loading the module.

This function is adapted from Stack Overflow answer by 'bignose'
http://stackoverflow.com/a/6811925.

The dont_write_bytecode setting is not supported on Python 2.4

The load_module_from_file function can be used to import 'control' files
for unit-testing purposes.

Signed-off-by: Ross Brattain