summaryrefslogtreecommitdiff
path: root/test/unittest_modutils.py
diff options
context:
space:
mode:
authorJulien Jehannet <julien.jehannet@logilab.fr>2010-11-23 12:22:58 +0100
committerJulien Jehannet <julien.jehannet@logilab.fr>2010-11-23 12:22:58 +0100
commit19a7ec4f5b3bdcb587263b32c2ee5ffea77fffff (patch)
treeeed563ea005c7279c16b45e677afffef6c23c593 /test/unittest_modutils.py
parentf05f14912c1cb2e9be16896839417407fc667935 (diff)
downloadlogilab-common-19a7ec4f5b3bdcb587263b32c2ee5ffea77fffff.tar.gz
[test] readd test about relative import
Diffstat (limited to 'test/unittest_modutils.py')
-rw-r--r--test/unittest_modutils.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/unittest_modutils.py b/test/unittest_modutils.py
index b473311..0ea2255 100644
--- a/test/unittest_modutils.py
+++ b/test/unittest_modutils.py
@@ -89,8 +89,9 @@ class get_module_part_tc(TestCase):
'logilab.common.modutils')
def test_knownValues_get_module_part_3(self):
- self.assertRaises(ImportError, modutils.get_module_part, 'db.get_connexion',
- modutils.__file__)
+ """relative import from given file"""
+ self.assertEqual(modutils.get_module_part('interface.Interface',
+ modutils.__file__), 'interface')
def test_knownValues_get_compiled_module_part(self):
self.assertEqual(modutils.get_module_part('math.log10'), 'math')
@@ -100,6 +101,10 @@ class get_module_part_tc(TestCase):
self.assertEqual(modutils.get_module_part('sys.path'), 'sys')
self.assertEqual(modutils.get_module_part('sys.path', '__file__'), 'sys')
+ def test_get_module_part_exception(self):
+ self.assertRaises(ImportError, modutils.get_module_part, 'unknown.module',
+ modutils.__file__)
+
class modpath_from_file_tc(TestCase):
""" given an absolute file path return the python module's path as a list """