[Python-checkins] r74560 - python/branches/py3k/Lib/importlib/test/import_/test___package__.py
brett.cannon
python-checkins at python.org
Fri Aug 28 01:46:38 CEST 2009
Author: brett.cannon
Date: Fri Aug 28 01:46:38 2009
New Revision: 74560
Log:
Make __package__ setting tests specific to importlib. Also move to assertRaises context manager.
Modified:
python/branches/py3k/Lib/importlib/test/import_/test___package__.py
Modified: python/branches/py3k/Lib/importlib/test/import_/test___package__.py
==============================================================================
--- python/branches/py3k/Lib/importlib/test/import_/test___package__.py (original)
+++ python/branches/py3k/Lib/importlib/test/import_/test___package__.py Fri Aug 28 01:46:38 2009
@@ -56,15 +56,16 @@
def test_bad__package__(self):
globals = {'__package__': '<not real>'}
- self.assertRaises(SystemError, import_util.import_,'', globals, {},
- ['relimport'], 1)
+ with self.assertRaises(SystemError):
+ import_util.import_('', globals, {}, ['relimport'], 1)
def test_bunk__package__(self):
globals = {'__package__': 42}
- self.assertRaises(ValueError, import_util.import_, '', globals, {},
- ['relimport'], 1)
+ with self.assertRaises(ValueError):
+ import_util.import_('', globals, {}, ['relimport'], 1)
+ at import_util.importlib_only
class Setting__package__(unittest.TestCase):
"""Because __package__ is a new feature, it is not always set by a loader.
More information about the Python-checkins
mailing list