@@ -8,18 +8,14 @@ import * as path from 'path';
88import { Uri } from 'vscode' ;
99import { IWorkspaceService } from '../../../common/application/types' ;
1010import { traceError } from '../../../common/logger' ;
11- import { IFileSystem } from '../../../common/platform/types' ;
1211import { TestDataItem } from '../../types' ;
1312import { getParentFile , getParentSuite , getTestType } from '../testUtils' ;
1413import { FlattenedTestFunction , FlattenedTestSuite , SubtestParent , TestFile , TestFolder , TestFunction , Tests , TestSuite , TestType } from '../types' ;
1514import { DiscoveredTests , ITestDiscoveredTestParser , TestContainer , TestItem } from './types' ;
1615
1716@injectable ( )
1817export class TestDiscoveredTestParser implements ITestDiscoveredTestParser {
19- constructor (
20- @inject ( IWorkspaceService ) private readonly workspaceService : IWorkspaceService ,
21- @inject ( IFileSystem ) private readonly fileSystem : IFileSystem
22- ) { }
18+ constructor ( @inject ( IWorkspaceService ) private readonly workspaceService : IWorkspaceService ) { }
2319 public parse ( resource : Uri , discoveredTests : DiscoveredTests [ ] ) : Tests {
2420 const tests : Tests = {
2521 rootTestFolders : [ ] ,
@@ -38,14 +34,8 @@ export class TestDiscoveredTestParser implements ITestDiscoveredTestParser {
3834
3935 // If the root is the workspace folder, then ignore that.
4036 for ( const data of discoveredTests ) {
41- // For now we only check the current workspace.
42- const root = this . findRoot ( data . root , [ workspace . uri . fsPath ] ) ;
43- if ( ! root ) {
44- // For now we only support tests from the workspace.
45- continue ;
46- }
4737 const rootFolder = {
48- name : root , folders : [ ] , time : 0 ,
38+ name : data . root , folders : [ ] , time : 0 ,
4939 testFiles : [ ] , resource : resource , nameToRun : data . rootid
5040 } ;
5141 tests . rootTestFolders . push ( rootFolder ) ;
@@ -68,7 +58,7 @@ export class TestDiscoveredTestParser implements ITestDiscoveredTestParser {
6858 * @param {Tests } tests
6959 * @memberof TestsDiscovery
7060 */
71- public buildChildren ( rootFolder : TestFolder , parent : TestDataItem , discoveredTests : DiscoveredTests , tests : Tests ) {
61+ protected buildChildren ( rootFolder : TestFolder , parent : TestDataItem , discoveredTests : DiscoveredTests , tests : Tests ) {
7262 const parentType = getTestType ( parent ) ;
7363 switch ( parentType ) {
7464 case TestType . testFolder : {
@@ -203,17 +193,6 @@ export class TestDiscoveredTestParser implements ITestDiscoveredTestParser {
203193 parent . functions . push ( ...functions ) ;
204194 tests . testFunctions . push ( ...functions . map ( func => createFlattenedParameterizedFunction ( tests , func , parent ) ) ) ;
205195 }
206-
207- /**
208- * Returns the vscode recognized file paths which matches the pytest data test root
209- */
210- private findRoot ( raw : string , roots : string [ ] ) : string | undefined {
211- for ( const root of roots ) {
212- if ( this . fileSystem . arePathsSame ( raw , root ) ) {
213- return root ;
214- }
215- }
216- }
217196}
218197
219198function createTestFolder ( root : TestFolder , item : TestContainer ) : TestFolder {
0 commit comments