From 903611cdd700a5ef2bb33503f7e1d03f2a01040c Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Fri, 3 Sep 2021 23:26:48 +0000 Subject: [PATCH 1/2] Fix for filenames starting with py. --- src/client/testing/testController/common/resultsHelper.ts | 2 +- .../testing/testController/common/testItemUtilities.ts | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/client/testing/testController/common/resultsHelper.ts b/src/client/testing/testController/common/resultsHelper.ts index 0b35d7411c1d..7eaceeb398d0 100644 --- a/src/client/testing/testController/common/resultsHelper.ts +++ b/src/client/testing/testController/common/resultsHelper.ts @@ -97,7 +97,7 @@ export async function updateResultFromJunitXml( } const result = junitSuite.testcase.find((t) => { - const idResult = getRunIdFromRawData(`${t.$.classname}.${t.$.name}`); + const idResult = getRunIdFromRawData(`${t.$.classname}::${t.$.name}`); const idNode = rawTestCaseNode.runId; return idResult === idNode || idNode.endsWith(idResult); }); diff --git a/src/client/testing/testController/common/testItemUtilities.ts b/src/client/testing/testController/common/testItemUtilities.ts index b20b8da4fac4..17bd171bbc50 100644 --- a/src/client/testing/testController/common/testItemUtilities.ts +++ b/src/client/testing/testController/common/testItemUtilities.ts @@ -88,9 +88,12 @@ function getRangeFromRawSource(raw: { source: string }): Range | undefined { } export function getRunIdFromRawData(id: string): string { + // TODO: This is a temporary solution to normalize test ids. + // The current method is error prone and easy to break. When we + // re-write the test adapters we should make sure we consider this. // This is the id that will be used to compare with the results. const runId = id - .replace(/\.py/g, '') + .replace(/\.py[^\w\-]/g, '') // we want to get rid of the `.py` in file names .replace(/[\\\:\/]/g, '.') .replace(/\:\:/g, '.') .replace(/\.\./g, '.'); From e33837492ee45faff10ba0727f9079b60b20a573 Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Fri, 3 Sep 2021 20:38:23 -0700 Subject: [PATCH 2/2] Add news item. --- news/2 Fixes/17270.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/2 Fixes/17270.md diff --git a/news/2 Fixes/17270.md b/news/2 Fixes/17270.md new file mode 100644 index 000000000000..fe0c948a4d71 --- /dev/null +++ b/news/2 Fixes/17270.md @@ -0,0 +1 @@ +Fix for test result not found for files starting with py.