Update flake8 and clang tests for wider version compatibility.

Review Request #12462 — Created July 11, 2022 and submitted — Latest diff uploaded

Information

ReviewBot
release-3.x

Reviewers

clang and flake8 have had some notable differences in the results
they provide across different (recent) versions.

Recent versions of clang treated 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 flake8 represented column indexes indexes
differently for syntax errors, causing the latest Python 2 and Python 3
versions of flake8 to produce different results.

The clang test code has been updated to use different syntax to avoid
the lambda assumption, and the flake8 test 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
precursor, assertRegexpMatches(), is deprecated there. To avoid
reinventing the wheel, we're now conditionally using the common
unittest2 library of backports for Python 2.7.

Unit tests pass locally.

Checked results manually on a CI Docker image to try to verify behavior.

Commits

Files

    Loading...