diff options
author | Brett Cannon <bcannon@gmail.com> | 2009-08-27 23:46:38 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2009-08-27 23:46:38 (GMT) |
commit | c5951fc996ad74a05e83a61cf0345a4a68c01b12 (patch) | |
tree | d4945f66b7a373db6ca227fb7076f24cc6ffb8f5 /Lib/importlib | |
parent | 6d2bb7f5aa17acac28737235959ec4ec852d833d (diff) | |
download | cpython-c5951fc996ad74a05e83a61cf0345a4a68c01b12.zip cpython-c5951fc996ad74a05e83a61cf0345a4a68c01b12.tar.gz cpython-c5951fc996ad74a05e83a61cf0345a4a68c01b12.tar.bz2 |
Make __package__ setting tests specific to importlib. Also move to assertRaises context manager.
Diffstat (limited to 'Lib/importlib')
-rw-r--r-- | Lib/importlib/test/import_/test___package__.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/importlib/test/import_/test___package__.py b/Lib/importlib/test/import_/test___package__.py index 2aa0814..4eb1f85 100644 --- a/Lib/importlib/test/import_/test___package__.py +++ b/Lib/importlib/test/import_/test___package__.py @@ -56,15 +56,16 @@ class Using__package__(unittest.TestCase): 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) +@import_util.importlib_only class Setting__package__(unittest.TestCase): """Because __package__ is a new feature, it is not always set by a loader. |