Skip to content

Commit a531cba

Browse files
Fix failing virtualenvwrapper Windows unit tests (#14012)
* Fix tests * Typo Co-authored-by: Karthik Nadig <[email protected]> Co-authored-by: Karthik Nadig <[email protected]>
1 parent 352d9a5 commit a531cba

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/client/pythonEnvironments/discovery/locators/services/virtualenvwrapperLocator.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ export async function isVirtualenvwrapperEnvironment(interpreterPath:string): Pr
2020
const environmentName = path.basename(path.dirname(path.dirname(interpreterPath)));
2121

2222
let environmentDir = path.join(workonHomeDir, environmentName);
23+
let pathToCheck = interpreterPath;
2324

2425
if (getOSType() === OSType.Windows) {
2526
environmentDir = environmentDir.toUpperCase();
27+
pathToCheck = interpreterPath.toUpperCase();
2628
}
2729

28-
return await pathExists(environmentDir) && interpreterPath.startsWith(`${environmentDir}${path.sep}`);
30+
return await pathExists(environmentDir) && pathToCheck.startsWith(`${environmentDir}${path.sep}`);
2931
}

src/test/pythonEnvironments/discovery/locators/virtualenvwrapperLocator.unit.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ suite('Virtualenvwrapper Locator Tests', () => {
2222
pathExistsStub = sinon.stub(fileUtils, 'pathExists');
2323
getDefaultDirStub = sinon.stub(virtualenvwrapperUtils, 'getDefaultVirtualenvwrapperDir');
2424

25-
pathExistsStub.withArgs(path.join(homeDir, envDirectory)).resolves(true);
26-
pathExistsStub.resolves(false);
25+
pathExistsStub.resolves(true);
2726
});
2827

2928
teardown(() => {
@@ -32,7 +31,7 @@ suite('Virtualenvwrapper Locator Tests', () => {
3231
getDefaultDirStub.restore();
3332
});
3433

35-
test('WORKON_HOME is not set, and the interpreter is is in a subfolder', async () => {
34+
test('WORKON_HOME is not set, and the interpreter is in a subfolder of virtualenvwrapper', async () => {
3635
const interpreter = path.join(homeDir, envDirectory, 'bin', 'python');
3736

3837
getEnvVariableStub.withArgs('WORKON_HOME').returns(undefined);
@@ -56,7 +55,6 @@ suite('Virtualenvwrapper Locator Tests', () => {
5655
const interpreter = path.join('some', 'path', envDirectory, 'bin', 'python');
5756

5857
getEnvVariableStub.withArgs('WORKON_HOME').returns(workonHomeDirectory);
59-
pathExistsStub.withArgs(path.join(workonHomeDirectory, envDirectory)).resolves(false);
6058

6159
assert.deepStrictEqual(await isVirtualenvwrapperEnvironment(interpreter), false);
6260
});

0 commit comments

Comments
 (0)