Flake8-ify the tests and use codes.* for status checks

This brings the whole code base in line with the same standards.

Signed-off-by: Don Naegely <naegelyd@gmail.com>