Skip to content

Commit

Permalink
Fix issues with multi-root workspace runs
Browse files Browse the repository at this point in the history
  • Loading branch information
karthiknadig committed Jul 28, 2021
1 parent fae3a47 commit 3263955
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
12 changes: 9 additions & 3 deletions src/client/testing/testController/pytest/pytestController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,15 @@ export class PytestController implements ITestFrameworkController {
): Promise<void> {
let runRequest = request;
if (!runRequest.include) {
const testItem = testController.items.get(workspace.uri.fsPath);
if (testItem) {
runRequest = new TestRunRequest([testItem], undefined, request.profile);
const testItems: TestItem[] = [];
testController.items.forEach((i) => {
const w = this.workspaceService.getWorkspaceFolder(i.uri);
if (w?.uri.fsPath === workspace.uri.fsPath) {
testItems.push(i);
}
});
if (testItems.length > 0) {
runRequest = new TestRunRequest(testItems, undefined, request.profile);
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/client/testing/testController/unittest/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ export class UnittestRunner implements ITestsRunner {
debug,
};

const runInstance = testController.createTestRun(request);
const runInstance = testController.createTestRun(
request,
`Running Tests for Workspace ${runOptions.workspaceFolder.fsPath}`,
true,
);
const dispose = options.token.onCancellationRequested(() => {
runInstance.end();
});
Expand Down
12 changes: 9 additions & 3 deletions src/client/testing/testController/unittest/unittestController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,15 @@ for s in generate_test_cases(suite):
): Promise<void> {
let runRequest = request;
if (!runRequest.include) {
const testItem = testController.items.get(workspace.uri.fsPath);
if (testItem) {
runRequest = new TestRunRequest([testItem], undefined, request.profile);
const testItems: TestItem[] = [];
testController.items.forEach((i) => {
const w = this.workspaceService.getWorkspaceFolder(i.uri);
if (w?.uri.fsPath === workspace.uri.fsPath) {
testItems.push(i);
}
});
if (testItems.length > 0) {
runRequest = new TestRunRequest(testItems, undefined, request.profile);
}
}

Expand Down

0 comments on commit 3263955

Please sign in to comment.