Enable linting for tests.

Previously tests were excluded from linting. As they
started to accumulate cruft (unused imports, style
differences...) already this patch enables linting them
and fixes all issues that occurred due to this.

This patch contains no functional changes.