Skip to content

test(python): assert the interpreter the analysis recorded, not a second probe - #310

Merged
adityankale190895 merged 1 commit into
DiffCI:mainfrom
FredApps:fix-python-test-interpreter
Nov 18, 2026
Merged

adityankale190895 merged 1 commit into
DiffCI:mainfrom
FredApps:fix-python-test-interpreter

Conversation

@FredApps

Copy link
Copy Markdown
Contributor

Fixes #304

The end-to-end test in tests/repo/python-adapter.test.ts probed for an interpreter itself at module load (pythonInterpreter(process.cwd())) and pinned the planned pytest command to that result. The adapter probed separately in the fixture directory. On a Windows runner, a slow or flaky python3 alias can make the two probes disagree (python3 vs python). The test then fails even though the planned command is valid.

Change: the test now uses the adapter's own result instead of a second probe.

  • It reads graph.profile.pythonInterpreter, the interpreter the adapter ran the import analysis with. The test already asserts there are no adapter blockers, so that interpreter is known to work.
  • It checks that interpreter is one of the adapter's candidates. src/repo/adapters/python.ts now exports them as PYTHON_INTERPRETER_CANDIDATES, and pythonInterpreter() loops over that list, so its behavior is unchanged.
  • It asserts the plan runs <interpreter> -m pytest … with that recorded interpreter.
  • New: a profile that recorded py -3 plans py -3 -m pytest …. This case runs the same on every OS.
  • The module-level probe now only decides whether to skip the suite.

The docblock on pythonInterpreter() notes that every call probes again, so callers should use the recorded interpreter.

Local checks:

  • npm run typecheck, npm run build, npm run audit:boundary and npm run agent:check
  • npm test: 1167 pass
  • CLI npm run build and npm run package:check

Both changed files are already in release-files.json. No Rust-adapter files are touched.

…ond probe

The end-to-end Python test probed for an interpreter itself at module load
and pinned the planned command to that result, while the adapter probed
again in the fixture directory. On Windows a slow or flaky python3 alias can
make the two probes disagree (python3 vs python), failing the test though the
planned command is valid (DiffCI#304).

The test now reads graph.profile.pythonInterpreter, the interpreter the
adapter analysed with, checks it is one of the adapter's exported
PYTHON_INTERPRETER_CANDIDATES, and asserts the plan runs pytest with it. It
also checks a recorded py -3 launcher reaches the planned command. The
module-level probe only decides whether to skip.

Fixes DiffCI#304

Signed-off-by: FredApps <[email protected]>
@FredApps
FredApps marked this pull request as ready for review November 18, 2026 00:55
FredApps added a commit to FredApps/core that referenced this pull request Nov 18, 2026
@adityankale190895
adityankale190895 merged commit 0732f44 into DiffCI:main Nov 18, 2026
13 checks passed
adityankale190895 pushed a commit that referenced this pull request Nov 18, 2026
* fix(maven): ignore XML comments when reading a POM

parsePom read tags with regular expressions over the raw XML, comments included. A commented-out <artifactId> before the real one became the module's identity, so dependent modules no longer linked to it and a change to it selected only its own tests. A commented-out <sourceDirectory> also triggered the custom source roots fallback.

Signed-off-by: FredApps <[email protected]>

* fix(maven): strip POM comments without a regex replace

CodeQL flagged the comment-stripping replace as incomplete multi-character sanitization. A single left-to-right pass removes the same comments and keeps an unterminated one, as before.

Signed-off-by: FredApps <[email protected]>

* test: add the SPDX licence header to the new test file

Signed-off-by: FredApps <[email protected]>

* chore: move the release-files.json entry so it merges cleanly with #211 and #253

The manifest is an unordered set, and the PRs listed above add their entries at the same line. Moving this entry one line away lets them merge in either order without a conflict.

Signed-off-by: FredApps <[email protected]>

* ci: re-run checks after the Windows Python interpreter flake (#304, fixed by #310)

Signed-off-by: FredApps <[email protected]>

---------

Signed-off-by: FredApps <[email protected]>
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.

Python adapter test: interpreter probed twice can disagree on Windows (python3 vs python), failing CI at random

2 participants