I'm trying to reach 100% testing coverage in a bit of code that I'm writing. The following block of code, however, is giving me trouble.
try:
from south.modelsinspector import add_introspection_rules
add_introspection_rules([], ["^localized_recurrence\.duration_field\.DurationField"])
except ImportError:
pass
The code above is part of my module under test. I need to create a test (without modifying the code above) which follows the ImportError
branch.
How can I programmatically cause the ImportError
to occur, while only writing code in my tests?