Skip to content

Commit eb998c5

Browse files
committed
fix: stabilize pip package integration tests
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: eb5f0ccb-cc13-4185-af62-e49f660c239a
1 parent 1917253 commit eb998c5

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

.github/instructions/testing-workflow.instructions.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ This guide covers the full testing lifecycle:
1616
4. **🛠️ Fixing Problems** - Resolve compilation and runtime issues
1717
5. **✅ Validation** - Ensure coverage and resilience
1818

19+
## Learnings
20+
21+
- Pip commands that return JSON must pass `--disable-pip-version-check`; the process helper combines stderr with stdout, so update notices can otherwise make valid JSON unparseable (1).
22+
1923
### When to Use This Guide
2024

2125
**User Requests Testing:**

src/managers/builtin/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ async function execPipList(environment: PythonEnvironment, log?: LogOutputChanne
200200
try {
201201
return await runPython(
202202
environment.execInfo.run.executable,
203-
['-m', 'pip', 'list', '--format=json', ...(args ?? [])],
203+
['-m', 'pip', 'list', '--format=json', '--disable-pip-version-check', ...(args ?? [])],
204204
undefined,
205205
log,
206206
undefined,

src/test/managers/builtin/pipPackageRefresh.unit.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,19 @@ suite('Pip package refresh', () => {
5050
assert.strictEqual(result, undefined);
5151
assert.ok(showErrorMessageWithLogsStub.notCalled);
5252
});
53+
54+
test('disables the pip version check when listing packages', async () => {
55+
const runPythonStub = helpers.runPython as sinon.SinonStub;
56+
runPythonStub.resolves('[]');
57+
58+
await refreshPipPackages(environment, log);
59+
60+
assert.deepStrictEqual(runPythonStub.firstCall.args[1], [
61+
'-m',
62+
'pip',
63+
'list',
64+
'--format=json',
65+
'--disable-pip-version-check',
66+
]);
67+
});
5368
});

0 commit comments

Comments
 (0)