diff options
author | sylvain thenault <sylvain.thenault@logilab.fr> | 2009-03-25 08:13:54 +0100 |
---|---|---|
committer | sylvain thenault <sylvain.thenault@logilab.fr> | 2009-03-25 08:13:54 +0100 |
commit | d65252632774eb17f4f33c389854d4deb982f80f (patch) | |
tree | 7b7103445dbc03b1f7fce6cc0ffb58f43c23a913 | |
parent | f59378c88501c7f72a4cc9120fcf732a7d41349a (diff) | |
download | logilab-common-d65252632774eb17f4f33c389854d4deb982f80f.tar.gz |
add test for zip/egg module search
-rw-r--r-- | test/data/MyPyPa-0.1.0-py2.5.egg | bin | 0 -> 1222 bytes | |||
l--------- | test/data/MyPyPa-0.1.0-py2.5.zip | 1 | ||||
-rw-r--r-- | test/unittest_modutils.py | 17 |
3 files changed, 18 insertions, 0 deletions
diff --git a/test/data/MyPyPa-0.1.0-py2.5.egg b/test/data/MyPyPa-0.1.0-py2.5.egg Binary files differnew file mode 100644 index 0000000..f62599c --- /dev/null +++ b/test/data/MyPyPa-0.1.0-py2.5.egg diff --git a/test/data/MyPyPa-0.1.0-py2.5.zip b/test/data/MyPyPa-0.1.0-py2.5.zip new file mode 120000 index 0000000..18b039d --- /dev/null +++ b/test/data/MyPyPa-0.1.0-py2.5.zip @@ -0,0 +1 @@ +MyPyPa-0.1.0-py2.5.egg
\ No newline at end of file diff --git a/test/unittest_modutils.py b/test/unittest_modutils.py index 09ec232..855a7b3 100644 --- a/test/unittest_modutils.py +++ b/test/unittest_modutils.py @@ -44,6 +44,17 @@ class TestCase(TLTestCase): sys.path.insert(0, common.__path__[0]) super(TestCase,self).tearDown() +class _module_file_tc(TestCase): + def test_find_zipped_module(self): + mtype, mfile = _module_file('mypypa', [path.join(DATADIR, 'MyPyPa-0.1.0-py2.5.zip')]) + self.assertEquals(mtype, modutils.ZIPFILE) + self.assertEquals(mfile, '') + + def test_find_egg_module(self): + mtype, mfile = _module_file('mypypa', [path.join(DATADIR, 'MyPyPa-0.1.0-py2.5.egg')]) + self.assertEquals(mtype, modutils.ZIPFILE) + self.assertEquals(mfile, '') + class load_module_from_name_tc(TestCase): @@ -123,6 +134,12 @@ class file_from_modpath_tc(TestCase): self.assertEqual(modutils.file_from_modpath(['sys']), None) + def test_knownValues_file_from_modpath_5(self): + from email import MIMEMultipart + print MIMEMultipart.__file__ + self.assertEqual(modutils.file_from_modpath(['email', 'MIMEMultipart']), + MIMEMultipart.__file__.replace('.pyc', '.py')) + def test_raise_file_from_modpath_Exception(self): self.assertRaises(ImportError, modutils.file_from_modpath, ['turlututu']) |