Catch RuntimeError in addition to ImportError when testing for matplotlib with things like:
I have some weird issue on my laptop where
throws a RuntimeError when DISPLAY is unset.
scons unsets DISPLAY when compiling.
This bug has allowed me to notice a few unncessary imports of pyplot, particular in test cases.