Make __package__ setting tests specific to importlib. Also move to assertRaises context manager.
This commit is contained in:
parent
6d2bb7f5aa
commit
c5951fc996
@ -56,15 +56,16 @@ class Using__package__(unittest.TestCase):
|
|||||||
|
|
||||||
def test_bad__package__(self):
|
def test_bad__package__(self):
|
||||||
globals = {'__package__': '<not real>'}
|
globals = {'__package__': '<not real>'}
|
||||||
self.assertRaises(SystemError, import_util.import_,'', globals, {},
|
with self.assertRaises(SystemError):
|
||||||
['relimport'], 1)
|
import_util.import_('', globals, {}, ['relimport'], 1)
|
||||||
|
|
||||||
def test_bunk__package__(self):
|
def test_bunk__package__(self):
|
||||||
globals = {'__package__': 42}
|
globals = {'__package__': 42}
|
||||||
self.assertRaises(ValueError, import_util.import_, '', globals, {},
|
with self.assertRaises(ValueError):
|
||||||
['relimport'], 1)
|
import_util.import_('', globals, {}, ['relimport'], 1)
|
||||||
|
|
||||||
|
|
||||||
|
@import_util.importlib_only
|
||||||
class Setting__package__(unittest.TestCase):
|
class Setting__package__(unittest.TestCase):
|
||||||
|
|
||||||
"""Because __package__ is a new feature, it is not always set by a loader.
|
"""Because __package__ is a new feature, it is not always set by a loader.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user