Problem
You don't have control over external libraries but you need to test how your software handles errors from them.Solution
Create duck-typed substitutes that call the external libraries but sometimes introduce errors. The percentage of errors should be low so that it doesn't interfere with other operations.
From
Udacity's Software Testing course.