Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hack to check the vscode version #21180

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"theme": "dark"
},
"engines": {
"vscode": "^1.78.0-20230421"
"vscode": "^1.78.0"
},
"keywords": [
"python",
Expand Down
4 changes: 2 additions & 2 deletions src/test/debuggerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import * as path from 'path';
import { runTests } from '@vscode/test-electron';
import { EXTENSION_ROOT_DIR_FOR_TESTS } from './constants';
import { getChannel } from './utils/vscode';
import { getVersion } from './utils/vscode';

const workspacePath = path.join(__dirname, '..', '..', 'src', 'testMultiRootWkspc', 'multi.code-workspace');
process.env.IS_CI_SERVER_TEST_DEBUGGER = '1';
Expand All @@ -17,7 +17,7 @@ function start() {
extensionDevelopmentPath: EXTENSION_ROOT_DIR_FOR_TESTS,
extensionTestsPath: path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'out', 'test', 'index'),
launchArgs: [workspacePath],
version: getChannel(),
version: getVersion(),
extensionTestsEnv: { ...process.env, UITEST_DISABLE_INSIDERS: '1' },
}).catch((ex) => {
console.error('End Debugger tests (with errors)', ex);
Expand Down
4 changes: 2 additions & 2 deletions src/test/multiRootTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as path from 'path';
import { runTests } from '@vscode/test-electron';
import { EXTENSION_ROOT_DIR_FOR_TESTS } from './constants';
import { initializeLogger } from './testLogger';
import { getChannel } from './utils/vscode';
import { getVersion } from './utils/vscode';

const workspacePath = path.join(__dirname, '..', '..', 'src', 'testMultiRootWkspc', 'multi.code-workspace');
process.env.IS_CI_SERVER_TEST_DEBUGGER = '';
Expand All @@ -17,7 +17,7 @@ function start() {
extensionDevelopmentPath: EXTENSION_ROOT_DIR_FOR_TESTS,
extensionTestsPath: path.join(EXTENSION_ROOT_DIR_FOR_TESTS, 'out', 'test', 'index'),
launchArgs: [workspacePath],
version: getChannel(),
version: getVersion(),
extensionTestsEnv: { ...process.env, UITEST_DISABLE_INSIDERS: '1' },
}).catch((ex) => {
console.error('End Multiroot tests (with errors)', ex);
Expand Down
4 changes: 2 additions & 2 deletions src/test/standardTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as path from 'path';
import { downloadAndUnzipVSCode, resolveCliPathFromVSCodeExecutablePath, runTests } from '@vscode/test-electron';
import { JUPYTER_EXTENSION_ID, PYLANCE_EXTENSION_ID } from '../client/common/constants';
import { EXTENSION_ROOT_DIR_FOR_TESTS } from './constants';
import { getChannel } from './utils/vscode';
import { getVersion } from './utils/vscode';

// If running smoke tests, we don't have access to this.
if (process.env.TEST_FILES_SUFFIX !== 'smoke.test') {
Expand Down Expand Up @@ -76,7 +76,7 @@ async function installPylanceExtension(vscodeExecutablePath: string) {
async function start() {
console.log('*'.repeat(100));
console.log('Start Standard tests');
const channel = getChannel();
const channel = getVersion();
console.log(`Using ${channel} build of VS Code.`);
const vscodeExecutablePath = await downloadAndUnzipVSCode(channel);
const baseLaunchArgs =
Expand Down
12 changes: 2 additions & 10 deletions src/test/utils/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,14 @@ import * as path from 'path';
import * as fs from 'fs-extra';
import { EXTENSION_ROOT_DIR } from '../../client/common/constants';

const insidersVersion = /^\^(\d+\.\d+\.\d+)-(insider|\d{8})$/;

export function getChannel(): string {
export function getVersion(): string {
if (process.env.VSC_PYTHON_CI_TEST_VSC_CHANNEL) {
return process.env.VSC_PYTHON_CI_TEST_VSC_CHANNEL;
}
const packageJsonPath = path.join(EXTENSION_ROOT_DIR, 'package.json');
if (fs.pathExistsSync(packageJsonPath)) {
const packageJson = fs.readJSONSync(packageJsonPath);
const engineVersion = packageJson.engines.vscode;
if (insidersVersion.test(engineVersion)) {
// Can't pass in the version number for an insiders build;
// https://github.com/microsoft/vscode-test/issues/176
return 'insiders';
}
return engineVersion.replace('^', '');
return packageJson.engines.vscode.replace('^', '');
}
return 'stable';
}