Skip to content

test(looper): drop wrapper lambdas flagged by code quality (#4182) - #4246

Merged
Qubitium merged 1 commit into
mainfrom
fix/issue-4182-code-quality
Nov 16, 2026
Merged

Qubitium merged 1 commit into
mainfrom
fix/issue-4182-code-quality

Conversation

@Qubitium

Copy link
Copy Markdown
Collaborator

Follow-up to #4242 (issue #4182).

#4242 squash-merged at 23bbc0ba0 while the code-quality follow-up was being pushed, so the two wrapper-lambda fixes did not land in main. This PR carries only that test cleanup.

Changes

  • tests/test_weight_only_looper.py: pass list directly to the as_completed monkeypatch instead of lambda mapping: list(mapping) in both drain tests. Same behavior, no wrapper.

Deliberately not changed

The three except BaseException findings stay as-is. Those loops drain every already-submitted future before propagating the first failure and mirror stage_subset._collect_worker_results (_WORKER_FAILURES = (BaseException,)). Narrowing to Exception would let KeyboardInterrupt/SystemExit skip the drain and abandon sibling futures, which is the leak the change fixes. Each thread on #4242 has a reply explaining this and is resolved.

Validation

  • ruff check gptqmodel docs/eora tests setup.py -> All checks passed
  • pytest tests/test_weight_only_looper.py::test_weight_only_quantize_subset_drains_workers_after_a_failure tests/test_weight_only_looper.py::test_weight_only_finalize_subset_drains_workers_after_a_failure -q -> 2 passed

Hardware: CPU only.

Pass the callable directly instead of a one-line lambda when mocking
as_completed. Keep the deliberate BaseException drain in the worker-result
loops: it mirrors stage_subset._collect_worker_results and ensures every
submitted future is resolved before the first failure propagates, including
control-flow exceptions.
@Qubitium
Qubitium merged commit c72475f into main Nov 16, 2026
6 checks passed
@Qubitium
Qubitium deleted the fix/issue-4182-code-quality branch November 16, 2026 05:53
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