Improve test coverage

I was unsure whether to omit the wsgi.py file from coverage, but I think it is probably good, because then the remaining areas of missing coverage are more clearly things that should be addressed.