@@ -10,7 +10,7 @@ import { ICondaService } from '../../client/interpreter/contracts';
1010import { CondaService } from '../../client/interpreter/locators/services/condaService' ;
1111import { ILinter , ILinterManager } from '../../client/linters/types' ;
1212import { TEST_OUTPUT_CHANNEL } from '../../client/testing/common/constants' ;
13- import { closeActiveWindows , initializeTest , IS_MULTI_ROOT_TEST } from '../initialize' ;
13+ import { closeActiveWindows , initialize , initializeTest , IS_MULTI_ROOT_TEST } from '../initialize' ;
1414import { UnitTestIocContainer } from '../testing/serviceRegistry' ;
1515
1616// tslint:disable:max-func-body-length no-invalid-this
@@ -26,9 +26,7 @@ suite('Multiroot Linting', () => {
2626 if ( ! IS_MULTI_ROOT_TEST ) {
2727 this . skip ( ) ;
2828 }
29- // https://github.com/microsoft/vscode-python/issues/9059
30- return this . skip ( ) ;
31- // return initialize();
29+ return initialize ( ) ;
3230 } ) ;
3331 setup ( async ( ) => {
3432 initializeDI ( ) ;
@@ -47,7 +45,7 @@ suite('Multiroot Linting', () => {
4745 ioc . registerProcessTypes ( ) ;
4846 ioc . registerLinterTypes ( ) ;
4947 ioc . registerVariableTypes ( ) ;
50- ioc . registerPlatformTypes ( ) ;
48+ ioc . registerFileSystemTypes ( ) ;
5149 ioc . registerMockInterpreterTypes ( ) ;
5250 ioc . serviceManager . addSingletonInstance < IProductService > ( IProductService , new ProductService ( ) ) ;
5351 ioc . serviceManager . addSingleton < ICondaService > ( ICondaService , CondaService ) ;
@@ -59,10 +57,9 @@ suite('Multiroot Linting', () => {
5957 ioc . serviceManager . addSingleton < IProductPathService > ( IProductPathService , DataScienceProductPathService , ProductType . DataScience ) ;
6058 }
6159
62- async function createLinter ( product : Product , resource ?: Uri ) : Promise < ILinter > {
60+ async function createLinter ( product : Product ) : Promise < ILinter > {
6361 const mockOutputChannel = ioc . serviceContainer . get < OutputChannel > ( IOutputChannel , TEST_OUTPUT_CHANNEL ) ;
6462 const lm = ioc . serviceContainer . get < ILinterManager > ( ILinterManager ) ;
65- await lm . setActiveLintersAsync ( [ product ] , resource ) ;
6663 return lm . createLinter ( product , mockOutputChannel , ioc . serviceContainer ) ;
6764 }
6865 async function testLinterInWorkspaceFolder ( product : Product , workspaceFolderRelativePath : string , mustHaveErrors : boolean ) : Promise < void > {
@@ -76,10 +73,6 @@ suite('Multiroot Linting', () => {
7673 const errorMessage = mustHaveErrors ? 'No errors returned by linter' : 'Errors returned by linter' ;
7774 assert . equal ( messages . length > 0 , mustHaveErrors , errorMessage ) ;
7875 }
79- async function enableDisableSetting ( workspaceFolder : string , configTarget : ConfigurationTarget , setting : string , value : boolean ) : Promise < void > {
80- const config = ioc . serviceContainer . get < IConfigurationService > ( IConfigurationService ) ;
81- await config . updateSetting ( setting , value , Uri . file ( workspaceFolder ) , configTarget ) ;
82- }
8376
8477 test ( 'Enabling Pylint in root and also in Workspace, should return errors' , async ( ) => {
8578 await runTest ( Product . pylint , true , true , pylintSetting ) ;
@@ -102,9 +95,15 @@ suite('Multiroot Linting', () => {
10295 } ) ;
10396
10497 async function runTest ( product : Product , global : boolean , wks : boolean , setting : string ) : Promise < void > {
105- const expected = wks ? wks : global ;
106- await enableDisableSetting ( multirootPath , ConfigurationTarget . Global , setting , global ) ;
107- await enableDisableSetting ( multirootPath , ConfigurationTarget . Workspace , setting , wks ) ;
108- await testLinterInWorkspaceFolder ( product , 'workspace1' , expected ) ;
98+ const config = ioc . serviceContainer . get < IConfigurationService > ( IConfigurationService ) ;
99+ await Promise . all ( [
100+ config . updateSetting ( setting , global , Uri . file ( multirootPath ) , ConfigurationTarget . Global ) ,
101+ config . updateSetting ( setting , wks , Uri . file ( multirootPath ) , ConfigurationTarget . Workspace )
102+ ] ) ;
103+ await testLinterInWorkspaceFolder ( product , 'workspace1' , wks ) ;
104+ await Promise . all (
105+ [ ConfigurationTarget . Global , ConfigurationTarget . Workspace ]
106+ . map ( configTarget => config . updateSetting ( setting , undefined , Uri . file ( multirootPath ) , configTarget ) )
107+ ) ;
109108 }
110109} ) ;
0 commit comments