You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lint test/ (not just git/), fix warnings and a bug
This expands flake8 linting to include the test suite, and fixes
the resulting warnings. Four code changes are especially notable:
- Unit tests from which documentation is automatically generated
contain a few occurrences of "# @NoEffect". These suppressions
are extended to "# noqa: B015 # @NoEffect" so the corresponding
suppression is also applied for flake8. This is significant
because it actually changes what appears in the code examples in
the generated documentation. However, since the "@NoEffect"
annotation was considered acceptable, this may be okay too. The
resulting examples did not become excessively long.
- Expressions like "[c for c in commits_for_file_generator]" appear
in some unit tests from which documentation is automatically
generated. The simpler form "list(commits_for_file_generator)"
can replace them. This changes the examples in the documentation,
but for the better, since that form is simpler (and also a better
practice in general, thus a better thing to show readers). So I
made those substitutions.
- In test_repo.TestRepo.test_git_work_tree_env, the code intended
to unpatch environment variables after the test was ineffective,
instead causing os.environ to refer to an ordinary dict object
that does not affect environment variables when written to. This
uses unittest.mock.patch.dict instead, so the variables are
unpatched and subsequent writes to environment variables in the
test process are effective.
- In test_submodule.TestSubmodule._do_base_tests, the expression
statement "csm.module().head.ref.tracking_branch() is not None"
appeared to be intended as an assertion, in spite of having been
annoated @NoEffect. This is in light of the context and because,
if the goal were only to exercise the function call, the
"is not None" part would be superfluous. So I made it an
assertion.
0 commit comments