autotest_firewalld_add_service_unittest: add proper wrapper to preserve sys.dont_write_bytecode value

To be more proper we should save and reset the value of
sys.dont_write_bytecode since it is a global system value.

We need to set dont_write_bytecode because if we don't when we
load a module from a file 'foo', python will write the bytecode to 'fooc',
or in this test case 'autotest-firewalld-add-servicec'

This function decorator is adapted from the original context manger from
http://stackoverflow.com/a/6811921
We have to use a function decorator since Python 2.4 doesn't have
context managers.

Eventually preserve_value should probably extracted and placed in
client/shared for use with importing and unittest 'control' files.

Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
autotest_firewalld_add_service_unittest: autopep8 formatting

Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
autotest-firewalld-add-service: make constant paths platform independent

Use os.path.join so the hard coded paths are platform independent.

Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
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 <ross.b.brattain@intel.com>
Merge pull request #781 from rbbratta/firewalld_fixes

autotest_firewalld_add_service_unittest: add proper wrapper to preserve sys.dont_write_bytecode value
Merge pull request #782 from rbbratta/file_module_loader

file_module_loader: add module importer for regular files