Fix Travis

Travis-CI that is; just couldn't resist such a sweet PR subject line.

Most of these commits are pretty clear fixes for things that were causing Travis-CI to choke. However, b7dff9339812 is a bit more involved (it can be spun out into its own PR if desired). I was looking into ways of injecting `matplotlib.use('Agg')` somewhere in the sequence of events that `pytest` does, and figured that we could make plotting easier in our tests using fixtures.

Note that in the end, I didn't end up putting `matplotlib.use('Agg')` in there anyhow, I just added a thing to `.travis.yml` (see b322bf75d0)