Skip to content

Commit

Permalink
fix launch debugger tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eleanorjboyd committed Oct 2, 2024
1 parent 1c20390 commit 30037af
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,15 @@ suite('pytest test execution adapter', () => {
});
test('Debug launched correctly for pytest', async () => {
const deferred3 = createDeferred();
utilsWriteTestIdsFileStub.callsFake(() => {
deferred3.resolve();
return Promise.resolve('testIdPipe-mockName');
});
utilsWriteTestIdsFileStub.callsFake(() => Promise.resolve('testIdPipe-mockName'));
debugLauncher
.setup((dl) => dl.launchDebugger(typeMoq.It.isAny(), typeMoq.It.isAny()))
.returns(async () => {
.returns(async (_opts, callback) => {
traceInfo('stubs launch debugger');
if (typeof callback === 'function') {
deferred3.resolve();
callback();
}
});
const testRun = typeMoq.Mock.ofType<TestRun>();
testRun
Expand All @@ -264,14 +265,7 @@ suite('pytest test execution adapter', () => {
const uri = Uri.file(myTestPath);
const outputChannel = typeMoq.Mock.ofType<ITestOutputChannel>();
adapter = new PytestTestExecutionAdapter(configService, outputChannel.object);
await adapter.runTests(
uri,
[],
TestRunProfileKind.Debug,
testRun.object,
execFactory.object,
debugLauncher.object,
);
adapter.runTests(uri, [], TestRunProfileKind.Debug, testRun.object, execFactory.object, debugLauncher.object);
await deferred3.promise;
debugLauncher.verify(
(x) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,15 @@ suite('Unittest test execution adapter', () => {
});
test('Debug launched correctly for unittest', async () => {
const deferred3 = createDeferred();
utilsWriteTestIdsFileStub.callsFake(() => {
deferred3.resolve();
return Promise.resolve('testIdPipe-mockName');
});
utilsWriteTestIdsFileStub.callsFake(() => Promise.resolve('testIdPipe-mockName'));
debugLauncher
.setup((dl) => dl.launchDebugger(typeMoq.It.isAny(), typeMoq.It.isAny()))
.returns(async () => {
.returns(async (_opts, callback) => {
traceInfo('stubs launch debugger');
if (typeof callback === 'function') {
deferred3.resolve();
callback();
}
});
const testRun = typeMoq.Mock.ofType<TestRun>();
testRun
Expand All @@ -263,14 +264,7 @@ suite('Unittest test execution adapter', () => {
const uri = Uri.file(myTestPath);
const outputChannel = typeMoq.Mock.ofType<ITestOutputChannel>();
adapter = new UnittestTestExecutionAdapter(configService, outputChannel.object);
await adapter.runTests(
uri,
[],
TestRunProfileKind.Debug,
testRun.object,
execFactory.object,
debugLauncher.object,
);
adapter.runTests(uri, [], TestRunProfileKind.Debug, testRun.object, execFactory.object, debugLauncher.object);
await deferred3.promise;
debugLauncher.verify(
(x) =>
Expand Down

0 comments on commit 30037af

Please sign in to comment.