Skip to content

Fix CI: the newest mypy and pylint, and test_positive_reverse_fusion - #531

Open
ulfarsson wants to merge 2 commits into
developfrom
fix-ci
Open

ulfarsson wants to merge 2 commits into
developfrom
fix-ci

Conversation

@ulfarsson

@ulfarsson ulfarsson commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

develop's CI fails on its own code. CI installs the newest mypy, pylint and pytest on every run, and they now flag three things that passed in January. A branch pushed at develop's head, c9618e0, fails the same jobs. This pull request fixes them, and changes no behavior.

  • mypy, tilings/algorithms/minimal_gridded_perms.py. MinimalGriddedPerms._better_bounds = None gave the cache the type None, so assigning the bounds' dict to it, and returning it, were errors. It is annotated as Optional[Dict[FrozenSet[Perm], int]].
  • mypy, tilings/strategies/factor.py. FactorFactory._build_strategy calls self.factor_class(..., tracked=...), but mypy types factor_class as FactorStrategy, which takes no tracked. Only the interleaving classes reach that call, so the class is cast to Type[FactorWithInterleavingStrategy] first. The pylint: disable=E1123 stays.
  • pylint R1716, tilings/tiling.py. Tiling.cell_within_bounds uses chained comparisons, 0 <= cell[0] < i and 0 <= cell[1] < j.
  • tests/strategies/test_reverse_fusion.py::test_positive_reverse_fusion. It asserts that exactly one warning is captured, and pytest 9 captured two. The cause: pytest 9 attaches its log-capture handler to loggers that do not propagate as well, such as logzero's, and the test makes logzero's logger propagate (for older pytest, which captured only through the root logger). So the one record reaches the handler twice, the same object both times. The test now counts each record once, and keeps its assertion.

Checked locally with tox, as CI runs it: flake8, mypy 2.4.0, pylint 4.1.3 and black 25.12.0 pass, and so do all 3719 tests on CPython 3.14 and on PyPy 3.11, with pytest 9.1.1.

One thing noticed in passing, and not changed: FactorFactory sets self.tracked only when the factor class is FactorWithInterleavingStrategy or FactorWithMonotoneInterleaving. The latter is the algorithm, not the strategy class FactorWithMonotoneInterleavingStrategy, so monotone interleaving factors are never tracked. That may be intended, or a slip.

🤖 Generated with Claude Code

ulfarsson and others added 2 commits October 19, 2026 14:30
…with pytest 9

develop's CI fails on its own code since the tools moved on: CI installs the
newest mypy, pylint and pytest each run.

- mypy: MinimalGriddedPerms._better_bounds is annotated as Optional, so that the
  cache's dict can be assigned to it; FactorFactory's interleaving factor class
  is cast to the class that takes `tracked` before it is called, as only the
  interleaving classes reach that call.
- pylint (R1716): Tiling.cell_within_bounds uses chained comparisons.
- test_positive_reverse_fusion: newer pytest can capture the one warning more
  than once, as the test also makes logzero's logger propagate, so the test now
  asserts that this warning is the only one, however often it is captured.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The cause of the second record, found with pytest 9.1.1: pytest now attaches its
log-capture handler to loggers that do not propagate as well, such as logzero's,
and this test makes logzero's logger propagate (for older pytest, which captured
only through the root logger), so the one record reaches the handler twice, the
same object both times. The test counts each record once again, and keeps its
assertion that the warning is the only one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant