Update flake8 and clang tests for wider version compatibility.
Review Request #12462 — Created July 11, 2022 and submitted
flake8have had some notable differences in the results
they provide across different (recent) versions.
Recent versions of
clangtreated what was supposed to be a syntax
error as part of an incomplete lambda, generating two errors instead of
the one we expected.
Different versions of
flake8represented column indexes indexes
differently for syntax errors, causing the latest Python 2 and Python 3
flake8to produce different results.
clangtest code has been updated to use different syntax to avoid
the lambda assumption, and the
flake8test code and assertions have
been updated to check better test code but to assert using a regex to
cover all bases.
That assertion uses
assertRegex(). This is only in Python 3, and the
assertRegexpMatches(), is deprecated there. To avoid
reinventing the wheel, we're now conditionally using the common
unittest2library of backports for Python 2.7.
Unit tests pass locally.
Checked results manually on a CI Docker image to try to verify behavior.