[pykickstart] Make sure tests can run and report import errors
Vratislav Podzimek
vpodzime at redhat.com
Thu Mar 14 09:23:46 UTC 2013
On Wed, 2013-03-13 at 18:39 -0700, Brian C. Lane wrote:
> From: "Brian C. Lane" <bcl at redhat.com>
>
> ---
> tests/baseclass.py | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> 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 good to me. Can we remove something from the "test" target in the
Makefile now that PYTHONPATH is set in the script?
--
Vratislav Podzimek
Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic
More information about the anaconda-patches
mailing list