[Python-checkins] r57001 - sandbox/trunk/import_in_py/tests/test_fs_importer.py
brett.cannon
python-checkins at python.org
Tue Aug 14 05:51:39 CEST 2007
Author: brett.cannon
Date: Tue Aug 14 05:51:37 2007
New Revision: 57001
Modified:
sandbox/trunk/import_in_py/tests/test_fs_importer.py
Log:
Test that ImportWarning is raised as needed.
Modified: sandbox/trunk/import_in_py/tests/test_fs_importer.py
==============================================================================
--- sandbox/trunk/import_in_py/tests/test_fs_importer.py (original)
+++ sandbox/trunk/import_in_py/tests/test_fs_importer.py Tue Aug 14 05:51:37 2007
@@ -91,7 +91,14 @@
def test_missing__init__warning(self):
# An ImportWarning should be raised if a directory matches a module
# name but no __init__ file exists.
- raise NotImplementedError
+ test_support.unlink(self.pkg_init_path)
+ with test_support.catch_warning() as w:
+ warnings.simplefilter('always', ImportWarning)
+ found = self.importer.find_module(self.pkg_name)
+ self.assert_(found is None)
+ self.assert_(issubclass(w.category, ImportWarning))
+ self.assert_(str(w.message).endswith("missing __init__"))
+
More information about the Python-checkins
mailing list