forked from microsoft/vscode-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigSettings.test.ts
More file actions
41 lines (35 loc) · 1.56 KB
/
configSettings.test.ts
File metadata and controls
41 lines (35 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import * as assert from 'assert';
import * as path from 'path';
import * as vscode from 'vscode';
import { IS_WINDOWS } from '../../client/common/platform/constants';
import { SystemVariables } from '../../client/common/variables/systemVariables';
import { getExtensionSettings } from '../common';
import { initialize } from './../initialize';
const workspaceRoot = path.join(__dirname, '..', '..', '..', 'src', 'test');
// Defines a Mocha test suite to group tests of similar kind together
suite('Configuration Settings', () => {
setup(initialize);
test('Check Values', (done) => {
const systemVariables: SystemVariables = new SystemVariables(undefined, workspaceRoot);
const pythonConfig = vscode.workspace.getConfiguration('python', (null as any) as vscode.Uri);
const pythonSettings = getExtensionSettings(vscode.Uri.file(workspaceRoot));
Object.keys(pythonSettings).forEach((key) => {
let settingValue = pythonConfig.get(key, 'Not a config');
if (settingValue === 'Not a config') {
return;
}
if (settingValue) {
settingValue = systemVariables.resolve(settingValue);
}
const pythonSettingValue = (pythonSettings as any)[key] as string;
if (key.endsWith('Path') && IS_WINDOWS) {
assert.equal(
settingValue.toUpperCase(),
pythonSettingValue.toUpperCase(),
`Setting ${key} not the same`,
);
}
});
done();
});
});