[pykickstart] Make sure tests can run and report import errors
Brian C. Lane
bcl at redhat.com
Thu Mar 14 01:39:36 UTC 2013
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()
--
1.8.1.2
More information about the anaconda-patches
mailing list