import_failure_test.py 430 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
# expected: fail
# - currently throws an AttributeError if we imported the module but the name didn't exist

try:
    import non_existent_module
    assert 0, "shouldn't get here"
except ImportError:
    pass

try:
    from non_existent_module import a
    assert 0, "shouldn't get here"
except ImportError:
    pass

try:
    from sys import non_existent_attribute
    assert 0, "shouldn't get here"
except ImportError:
    pass