[pykickstart] Make sure tests can run and report import errors

Chris Lumens clumens at redhat.com
Thu Mar 14 15:08:21 UTC 2013


> diff --git a/tests/baseclass.py b/tests/baseclass.py
> index 9d9e8c3..b4f183b 100644
> --- a/tests/baseclass.py
> +++ b/tests/baseclass.py
> @@ -169,7 +169,7 @@ def loadModules(moduleDir, cls_pattern="_TestCase", skip_list=["__init__", "base
>              found = imputil.imp.find_module(module)
>              loaded = imputil.imp.load_module(module, found[0], found[1], found[2])
>          except ImportError, e:
> -            print(_("Error loading module %s.") % module)
> +            print(_("Error loading module %s: %s") % (module, e))
>              continue
>  
>          # Find class names that match the supplied pattern (default: "_TestCase")
> @@ -188,6 +188,8 @@ def loadModules(moduleDir, cls_pattern="_TestCase", skip_list=["__init__", "base
>  
>  # Run the tests
>  if __name__ == "__main__":
> +    # Make sure PWD is in the path before the eggs, system paths, etc.
> +    sys.path.insert(0, os.environ.get("PWD"))
>  
>      # Create a test suite
>      PyKickstartTestSuite = unittest.TestSuite()

Looks fine to me.

- Chris


More information about the anaconda-patches mailing list