44import { assert } from 'chai' ;
55import * as fs from 'fs-extra' ;
66import * as path from 'path' ;
7+ import * as sinon from 'sinon' ;
8+ import { DiscoveryVariants } from '../../../../client/common/experiments/groups' ;
79import { traceWarning } from '../../../../client/common/logger' ;
810import { FileChangeType } from '../../../../client/common/platform/fileSystemWatcher' ;
911import { createDeferred , Deferred , sleep } from '../../../../client/common/utils/async' ;
1012import { PythonEnvKind } from '../../../../client/pythonEnvironments/base/info' ;
1113import { getEnvs } from '../../../../client/pythonEnvironments/base/locatorUtils' ;
1214import { PythonEnvsChangedEvent } from '../../../../client/pythonEnvironments/base/watcher' ;
13- import { arePathsSame } from '../../../../client/pythonEnvironments/common/externalDependencies' ;
15+ import * as externalDeps from '../../../../client/pythonEnvironments/common/externalDependencies' ;
1416import { WindowsStoreLocator } from '../../../../client/pythonEnvironments/discovery/locators/services/windowsStoreLocator' ;
1517import { TEST_TIMEOUT } from '../../../constants' ;
1618import { TEST_LAYOUT_ROOT } from '../../common/commonTestConstants' ;
@@ -54,6 +56,7 @@ class WindowsStoreEnvs {
5456}
5557
5658suite ( 'Windows Store Locator' , async ( ) => {
59+ let inExperimentStub : sinon . SinonStub ;
5760 const testLocalAppData = path . join ( TEST_LAYOUT_ROOT , 'storeApps' ) ;
5861 const testStoreAppRoot = path . join ( testLocalAppData , 'Microsoft' , 'WindowsApps' ) ;
5962 const windowsStoreEnvs = new WindowsStoreEnvs ( testStoreAppRoot ) ;
@@ -74,14 +77,19 @@ suite('Windows Store Locator', async () => {
7477
7578 async function isLocated ( executable : string ) : Promise < boolean > {
7679 const items = await getEnvs ( locator . iterEnvs ( ) ) ;
77- return items . some ( ( item ) => arePathsSame ( item . executable . filename , executable ) ) ;
80+ return items . some ( ( item ) => externalDeps . arePathsSame ( item . executable . filename , executable ) ) ;
7881 }
7982
8083 suiteSetup ( async ( ) => {
8184 process . env . LOCALAPPDATA = testLocalAppData ;
8285 await windowsStoreEnvs . cleanUp ( ) ;
8386 } ) ;
8487
88+ setup ( ( ) => {
89+ inExperimentStub = sinon . stub ( externalDeps , 'inExperiment' ) ;
90+ inExperimentStub . withArgs ( DiscoveryVariants . discoverWithFileWatching ) . resolves ( true ) ;
91+ } ) ;
92+
8593 async function setupLocator ( onChanged : ( e : PythonEnvsChangedEvent ) => Promise < void > ) {
8694 locator = new WindowsStoreLocator ( ) ;
8795 await getEnvs ( locator . iterEnvs ( ) ) ; // Force the watchers to start.
@@ -91,6 +99,7 @@ suite('Windows Store Locator', async () => {
9199 }
92100
93101 teardown ( async ( ) => {
102+ inExperimentStub . restore ( ) ;
94103 await windowsStoreEnvs . cleanUp ( ) ;
95104 await locator . dispose ( ) ;
96105 } ) ;
0 commit comments