Skip to content

Commit

Permalink
Skip tests per platform
Browse files Browse the repository at this point in the history
  • Loading branch information
kimadeline committed Sep 18, 2020
1 parent b2b6002 commit 9bb444b
Showing 1 changed file with 32 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,29 @@ suite('Environment Identifier', () => {
getUserHomeDirStub.restore();
});

test('PYENV_ROOT is not set on non-Windows, fallback to the default value ~/.pyenv', async () => {
test('PYENV_ROOT is not set on non-Windows, fallback to the default value ~/.pyenv', async function () {
if (getOSTypeForTest() === OSType.Windows) {
// tslint:disable-next-line: no-invalid-this
return this.skip();
}

const interpreterPath = path.join(TEST_LAYOUT_ROOT, 'pyenv1', '.pyenv', 'versions', '3.6.9', 'bin', 'python');

getUserHomeDirStub.returns(path.join(TEST_LAYOUT_ROOT, 'pyenv1'));
getEnvVarStub.withArgs('PYENV_ROOT').returns(undefined);

const envType: EnvironmentType = await identifyEnvironment(interpreterPath);
assert.deepStrictEqual(envType, EnvironmentType.Pyenv);

return undefined;
});

test('PYENV is not set on Windows, fallback to the default value %USERPROFILE%\\.pyenv\\pyenv-win', async () => {
test('PYENV is not set on Windows, fallback to the default value %USERPROFILE%\\.pyenv\\pyenv-win', async function () {
if (getOSTypeForTest() !== OSType.Windows) {
// tslint:disable-next-line: no-invalid-this
return this.skip();
}

const interpreterPath = path.join(TEST_LAYOUT_ROOT, 'pyenv2', '.pyenv', 'pyenv-win', 'versions', '3.6.9', 'bin', 'python.exe');

getUserHomeDirStub.returns(path.join(TEST_LAYOUT_ROOT, 'pyenv2'));
Expand All @@ -169,25 +181,41 @@ suite('Environment Identifier', () => {

const envType: EnvironmentType = await identifyEnvironment(interpreterPath);
assert.deepStrictEqual(envType, EnvironmentType.Pyenv);

return undefined;
});

test('PYENV_ROOT is set to a custom value on non-Windows', async () => {
test('PYENV_ROOT is set to a custom value on non-Windows', async function () {
if (getOSTypeForTest() === OSType.Windows) {
// tslint:disable-next-line: no-invalid-this
return this.skip();
}

const interpreterPath = path.join(TEST_LAYOUT_ROOT, 'pyenv3', 'versions', '3.6.9', 'bin', 'python');

getEnvVarStub.withArgs('PYENV_ROOT').returns(path.join(TEST_LAYOUT_ROOT, 'pyenv3'));

const envType: EnvironmentType = await identifyEnvironment(interpreterPath);
assert.deepStrictEqual(envType, EnvironmentType.Pyenv);

return undefined;
});

test('PYENV is set to a custom value on Windows', async () => {
test('PYENV is set to a custom value on Windows', async function () {
if (getOSTypeForTest() !== OSType.Windows) {
// tslint:disable-next-line: no-invalid-this
return this.skip();
}

const interpreterPath = path.join(TEST_LAYOUT_ROOT, 'pyenv3', 'versions', '3.6.9', 'bin', 'python.exe');

getEnvVarStub.withArgs('PYENV').returns(path.join(TEST_LAYOUT_ROOT, 'pyenv3'));
getOsTypeStub.returns(platformApis.OSType.Windows);

const envType: EnvironmentType = await identifyEnvironment(interpreterPath);
assert.deepStrictEqual(envType, EnvironmentType.Pyenv);

return undefined;
});
});

Expand Down

0 comments on commit 9bb444b

Please sign in to comment.