Beispiel #1
0
 def t():
     with assert_raises(ImportError) as ecm:
         try:
             import nonexistent
         except ImportError as ex:
             enhance_import_error(ex, 'PyNonexistent', None,
                                  'http://pynonexistent.example.net/')
             raise
         nonexistent.f()  # quieten pyflakes
     assert_equal(
         str(ecm.exception), 'No module named nonexistent; '
         'please install the PyNonexistent package <http://pynonexistent.example.net/>'
     )
Beispiel #2
0
 def test_debian(self):
     with interim(lib.utils, debian=True):
         with assert_raises(ImportError) as ecm:
             try:
                 import nonexistent
             except ImportError as ex:
                 enhance_import_error(ex, 'PyNonexistent',
                                      'python-nonexistent',
                                      'http://pynonexistent.example.net/')
                 raise
             nonexistent.f()  # quieten pyflakes
         assert_equal(
             str(ecm.exception), 'No module named nonexistent; '
             'please install the python-nonexistent package')
Beispiel #3
0
 def test_nondebian(self):
     with interim(utils, debian=False):
         with assert_raises(ImportError) as ecm:
             try:
                 import nonexistent
             except ImportError as ex:
                 utils.enhance_import_error(ex,
                     'PyNonexistent',
                     'python-nonexistent',
                     'http://pynonexistent.example.net/'
                 )
                 raise
             nonexistent.f()  # quieten pyflakes
         assert_equal(str(ecm.exception),
             'No module named nonexistent; '
             'please install the PyNonexistent package <http://pynonexistent.example.net/>'
         )