On Thu, Mar 14, 2013 at 10:23:46AM +0100, Vratislav Podzimek wrote:
On Wed, 2013-03-13 at 18:39 -0700, Brian C. Lane wrote:
> From: "Brian C. Lane" <bcl(a)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?
You would think so, but in my tests it ended up pulling the pykickstart
modules from the system instead, and leaving it there doesn't hurt. I'm
not sure if this is some odd behavior of imputil or what.
--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)