Skip to content

Commit f158cef

Browse files
authored
Ensure runId is formatted the same way as results. (microsoft#17086)
* Ensure runId is formatted the same way as results. * Add news item.
1 parent 84f4fcc commit f158cef

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

news/2 Fixes/17079.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix for testing ui update issue when `pytest` parameter has '/'.

src/client/testing/testController/common/resultsHelper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import * as fsapi from 'fs-extra';
55
import { Location, TestItem, TestMessage, TestRun } from 'vscode';
6-
import { getTestCaseNodes } from './testItemUtilities';
6+
import { getRunIdFromRawData, getTestCaseNodes } from './testItemUtilities';
77
import { TestData } from './types';
88

99
type TestSuiteResult = {
@@ -97,7 +97,7 @@ export async function updateResultFromJunitXml(
9797
}
9898

9999
const result = junitSuite.testcase.find((t) => {
100-
const idResult = `${t.$.classname}.${t.$.name}`;
100+
const idResult = getRunIdFromRawData(`${t.$.classname}.${t.$.name}`);
101101
const idNode = rawTestCaseNode.runId;
102102
return idResult === idNode || idNode.endsWith(idResult);
103103
});

src/client/testing/testController/common/testItemUtilities.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ function getRangeFromRawSource(raw: { source: string }): Range | undefined {
8787
return undefined;
8888
}
8989

90-
function getRunIdFromRawData(raw: { id: string }): string {
90+
export function getRunIdFromRawData(id: string): string {
9191
// This is the id that will be used to compare with the results.
92-
const runId = raw.id
92+
const runId = id
9393
.replace(/\.py/g, '')
9494
.replace(/[\\\:\/]/g, '.')
9595
.replace(/\:\:/g, '.')
@@ -166,7 +166,7 @@ function createCollectionTestItem(
166166
const label = rawData.name;
167167

168168
const parentId = getParentIdFromRawParentId(idToRawData, testRoot, rawData);
169-
const runId = getRunIdFromRawData(rawData);
169+
const runId = getRunIdFromRawData(rawData.id);
170170

171171
const testItem = testController.createTestItem(id, label, uri);
172172

@@ -197,7 +197,7 @@ function updateCollectionTestItem(
197197
item.label = rawData.name;
198198

199199
const parentId = getParentIdFromRawParentId(idToRawData, testRoot, rawData);
200-
const runId = getRunIdFromRawData(rawData);
200+
const runId = getRunIdFromRawData(rawData.id);
201201

202202
item.canResolveChildren = true;
203203

@@ -230,7 +230,7 @@ function createTestCaseItem(
230230
const label = rawData.name;
231231

232232
const parentId = getParentIdFromRawParentId(idToRawData, testRoot, rawData);
233-
const runId = getRunIdFromRawData(rawData);
233+
const runId = getRunIdFromRawData(rawData.id);
234234

235235
const testItem = testController.createTestItem(id, label, uri);
236236

@@ -262,7 +262,7 @@ function updateTestCaseItem(
262262
item.label = rawData.name;
263263

264264
const parentId = getParentIdFromRawParentId(idToRawData, testRoot, rawData);
265-
const runId = getRunIdFromRawData(rawData);
265+
const runId = getRunIdFromRawData(rawData.id);
266266

267267
item.canResolveChildren = false;
268268
item.range = getRangeFromRawSource(rawData);

0 commit comments

Comments
 (0)