From a439535a95d628e3cddec6310d34debcf6febcc6 Mon Sep 17 00:00:00 2001 From: Kartik Raj Date: Thu, 5 Nov 2020 11:00:58 -0800 Subject: [PATCH] Fix failing global virtual env watcher tests --- src/client/pythonEnvironments/common/pythonBinariesWatcher.ts | 2 +- .../locators/globalVirtualEnvironmentLocator.testvirtualenvs.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/client/pythonEnvironments/common/pythonBinariesWatcher.ts b/src/client/pythonEnvironments/common/pythonBinariesWatcher.ts index 95878967a386..ba4c3fb5c20f 100644 --- a/src/client/pythonEnvironments/common/pythonBinariesWatcher.ts +++ b/src/client/pythonEnvironments/common/pythonBinariesWatcher.ts @@ -29,7 +29,7 @@ export function watchLocationForPythonBinaries( const disposables = new DisposableRegistry(); for (const pattern of patterns) { disposables.push(watchLocationForPattern(baseDir, pattern, (type: FileChangeType, e: string) => { - const isMatch = minimatch(e, path.join('**', executableBaseGlob), { nocase: getOSType() === OSType.Windows }); + const isMatch = minimatch(path.basename(e), executableBaseGlob, { nocase: getOSType() === OSType.Windows }); if (!isMatch) { // When deleting the file for some reason path to all directories leading up to python are reported // Skip those events diff --git a/src/test/pythonEnvironments/discovery/locators/globalVirtualEnvironmentLocator.testvirtualenvs.ts b/src/test/pythonEnvironments/discovery/locators/globalVirtualEnvironmentLocator.testvirtualenvs.ts index a4650c3cf751..d6bedf364a8b 100644 --- a/src/test/pythonEnvironments/discovery/locators/globalVirtualEnvironmentLocator.testvirtualenvs.ts +++ b/src/test/pythonEnvironments/discovery/locators/globalVirtualEnvironmentLocator.testvirtualenvs.ts @@ -62,6 +62,7 @@ suite('GlobalVirtualEnvironment Locator', async () => { setup(async () => { process.env.WORKON_HOME = testWorkOnHomePath; locator = new GlobalVirtualEnvironmentLocator(); + await locator.initialize(); // Wait for watchers to get ready await sleep(1000); });