Skip to content

Commit ebdea0d

Browse files
authored
Cherry pick fixes from main (microsoft#17348)
* Fix for filenames starting with py. (microsoft#17275) * Fix for filenames starting with py. * Add news item. * Update change logs for cherry pick
1 parent 57eaac1 commit ebdea0d

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
([#17309](https://github.com/Microsoft/vscode-python/issues/17309))
2727
1. For CI ensure `tensorboard` is installed in python 3 environments only.
2828
([#17325](https://github.com/Microsoft/vscode-python/issues/17325))
29+
1. Fix for test result not found for files starting with py.
30+
([#17270](https://github.com/Microsoft/vscode-python/issues/17270))
2931

3032
### Thanks
3133

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export async function updateResultFromJunitXml(
9797
}
9898

9999
const result = junitSuite.testcase.find((t) => {
100-
const idResult = getRunIdFromRawData(`${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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,12 @@ function getRangeFromRawSource(raw: { source: string }): Range | undefined {
8888
}
8989

9090
export function getRunIdFromRawData(id: string): string {
91+
// TODO: This is a temporary solution to normalize test ids.
92+
// The current method is error prone and easy to break. When we
93+
// re-write the test adapters we should make sure we consider this.
9194
// This is the id that will be used to compare with the results.
9295
const runId = id
93-
.replace(/\.py/g, '')
96+
.replace(/\.py[^\w\-]/g, '') // we want to get rid of the `.py` in file names
9497
.replace(/[\\\:\/]/g, '.')
9598
.replace(/\:\:/g, '.')
9699
.replace(/\.\./g, '.');

0 commit comments

Comments
 (0)