Skip to content

Commit f8adfba

Browse files
Copilotrchiodo
andauthored
test: cover pytest launch fields in child-process attach regression
Agent-Logs-Url: https://github.com/microsoft/vscode-python-debugger/sessions/e202ee48-f8d2-4bb4-a5bb-25832c5bd98e Co-authored-by: rchiodo <19672699+rchiodo@users.noreply.github.com>
1 parent 794fdc7 commit f8adfba

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

src/test/unittest/hooks/childProcessAttachService.unit.test.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,4 +235,32 @@ suite('Debug - Attach to Child Process', () => {
235235
// The original data object must not be mutated.
236236
expect(data).to.have.property('purpose').deep.equal(['debug-test']);
237237
});
238+
test('Child process attach keeps pytest launch fields while removing debug-test purpose', async () => {
239+
const data: AttachRequestArguments = {
240+
request: 'attach',
241+
type: debuggerTypeName,
242+
name: 'Attach',
243+
port: 1234,
244+
subProcessId: 2,
245+
purpose: ['debug-test'],
246+
module: 'pytest',
247+
args: ['-s', '${workspaceFolder}/tests/test_multiproc.py'],
248+
console: 'integratedTerminal',
249+
};
250+
const session: any = {};
251+
252+
getWorkspaceFoldersStub.returns(undefined);
253+
startDebuggingStub.resolves(true);
254+
255+
await attachService.attach(data, session);
256+
257+
sinon.assert.calledOnce(startDebuggingStub);
258+
const [, secondArg] = startDebuggingStub.args[0];
259+
expect(secondArg).to.include({
260+
module: 'pytest',
261+
console: 'integratedTerminal',
262+
});
263+
expect(secondArg).to.have.property('args').deep.equal(['-s', '${workspaceFolder}/tests/test_multiproc.py']);
264+
expect(secondArg).to.not.have.property('purpose');
265+
});
238266
});

0 commit comments

Comments
 (0)