Skip to content

[diagnostic] Reproduce #9168 cyclic-import macOS gap#11048

Draft
Pierre-Sassoulas wants to merge 5 commits into
pylint-dev:mainfrom
Pierre-Sassoulas:try-reproduce-9168-on-macos
Draft

[diagnostic] Reproduce #9168 cyclic-import macOS gap#11048
Pierre-Sassoulas wants to merge 5 commits into
pylint-dev:mainfrom
Pierre-Sassoulas:try-reproduce-9168-on-macos

Conversation

@Pierre-Sassoulas

@Pierre-Sassoulas Pierre-Sassoulas commented May 25, 2026

Copy link
Copy Markdown
Member

Type of Changes

🧪 Test

Purpose

Diagnostic only. Do not merge.

Sweeps the Needs reproduction :mag: backlog: each test recreates a reporter's minimal repro under tmp_path, runs pylint as a subprocess, and asserts whether the originally reported signature is present. CI on Linux / macOS / Windows then tells us, per issue, whether the bug is real today, silently fixed, or platform-specific.

#9168 — does the bug still reproduce on macOS?

test_cyclic_import_9168.py builds the reporter's layout and asserts cyclic-import is emitted. Expected outcomes:

  • Linux passes, macOS fails: the platform-dependent gap is still real. File a follow-up against astroid module-name resolution on case-insensitive / mounted filesystems.
  • Both pass: silently fixed since 3.0.1. Close Inconsistent behavior with circular import on MacOS #9168 and promote the test to regression-tests-fixed-issues.
  • Both fail: my repro is wrong; redo.

Six "apparently fixed" issues — does the fix hold?

Six tests, one per issue, assert the originally reported signature is absent:

Issue Symptom asserted absent Repro tested
#4899 no-member / not-an-iterable pydantic.dataclasses + field(default_factory=lambda: [])
#4917 no-member rebinding inside a with CtxMgr() as x: block
#7268 astroid crash class Color(NamedTuple): A, B = 1, 2 (tuple-unpacked attrs)
#8980 no-name-in-module namespace-shared azure.monitor.opentelemetry.exporter imports
#9137 UninferableBase crash LEGACY_JSON_OPTIONS.with_options(...) from bson.json_util
#9983 unexpected-keyword-arg (synthetic Uninferable_factory) Registry(**{f"{name}_factory": ...})

All-green on a platform means the bug is fixed there. Ask the reporter to confirm on a current release, close, and promote the test.

#4667 — cross-check the Py3.9-only argparse FP

argparse.ArgumentParser subclass once tripped no-member on Namespace attribute access (Py3.9-only at filing). Pylint no longer supports 3.9, but test_argparse_subclass_4667.py exercises the same shape on every supported interpreter to confirm the FP doesn't sneak back in elsewhere.

Two "still-real" bugs surfaced by trying the full user repro

My first attempt at a minimal repro for these two missed the trigger. Re-running with the reporter's full code reproduces the bug today on Linux. Both tests assert the FP is present (an inverted diagnostic) so that when CI flips green the bug is gone.

Issue Symptom asserted present Why we need the full code
#6352 no-member on Gtk.Window inherited methods Triggered only when the Gtk.Window subclass also sets an instance attribute on self
#7122 not-an-iterable on apt_pkg SourceRecords.binaries / Acquire.items Triggered against the full chain apt.progress.text.AcquireProgress() + apt.Cache(rootdir=...)

Library-dependent tests use pytest.importorskip: pydantic / azure-monitor-opentelemetry-exporter / pymongo / pytz / gi / apt / apt_pkg. They skip cleanly where the dep is absent and run wherever it is present (e.g. a Linux runner with python3-gi and python3-apt installed).

Locally on Linux (Py3.12, with PyGObject and python3-apt installed system-wide) all ten tests pass.

Pierre-Sassoulas and others added 3 commits May 25, 2026 18:09
…forms

pylint-dev#9168 reports that the same project layout produces R0401 cyclic-import
on Linux but not on macOS. This subprocess-based test sets up the
reporter's exact directory layout in tmp_path and asserts the warning
fires.

Purpose: use the macOS CI runner to confirm whether the bug still
reproduces on current main. If the assertion fails on macOS only, the
platform-dependent behavior is confirmed; if both platforms pass, the
bug has been silently fixed.

Not intended for merge as-is.
…pand_modules

unittest_expand_modules.py parametrizes against a fixed list of files in
tests/lint/. Putting a new file in that directory failed all CI jobs.
… reproduce

For each issue, build the reporter's minimal repro in tmp_path and assert
that the originally-reported false positive or crash signature is absent.
If CI is green on all platforms, the bugs are silently fixed since the
issue was filed and can be closed.

- pylint-dev#4899  pydantic field(default_factory=lambda: []) no-member / not-an-iterable
- pylint-dev#4917  with-block rebinding no-member
- pylint-dev#7268  NamedTuple multi-assignment crash
- pylint-dev#8980  azure-monitor namespace package no-name-in-module
- pylint-dev#9137  bson LEGACY_JSON_OPTIONS.with_options UninferableBase crash
- pylint-dev#9983  Uninferable_factory unexpected-keyword-arg FP
- pylint-dev#4667 (argparse subclass + Py3.9-only no-member): assert FP absent.
  The bug was Py3.9-only at filing, but Py3.9 is no longer supported,
  so we cross-check the fix on every supported interpreter.
- pylint-dev#6352 (Gtk.Window subclass + self.x assignment → no-member on add/
  show_all): assert FP IS present. PyGObject-only; pytest skips
  elsewhere. When the assertion flips, the bug is fixed.
- pylint-dev#7122 (apt_pkg SourceRecords.binaries / Acquire.items not-an-iterable):
  assert FP IS present. python3-apt only; pytest skips elsewhere.

The latter two were originally on my 'cannot reproduce without external
env' list. Trying harder with the reporter's full code (not just my
distilled minimum) shows both bugs are still real today.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Inconsistent behavior with circular import on MacOS

1 participant