TST: Rework style test skip
Also redoes some of the changes that were inadvertently reverted
in https://github.com/pydata/pandas/pull/12260.

That PR had two commits, one of which was an older version of
what was eventually merged in
https://github.com/pydata/pandas/pull/12162.

The stale commit incorrectly merged was a15248ae7.
It should have been a3c38fe82.

For the most part the changes were just style, but there was a python2
import error, which our tests didn't fail on because I was trying to
catch a jinja ImportError, and instead caught all ImportErrors.
