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

Test with no --extensions-dir #12099

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
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
60 changes: 33 additions & 27 deletions src/test/standardTest.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function requiresPythonExtensionToBeInstalled() {
}

const channel = (process.env.VSC_JUPYTER_CI_TEST_VSC_CHANNEL || '').toLowerCase().includes('insiders')
? '3fb8e8feb1c93a490feb2c2259713d4c8f0e0058'
? 'insiders'
: 'stable';

function computePlatform() {
Expand All @@ -56,21 +56,45 @@ async function createTempDir() {
/**
* Smoke tests & tests running in VSCode require Python extension to be installed.
*/
async function installPythonExtension(vscodeExecutablePath: string, extensionsDir: string, platform: DownloadPlatform) {
async function installPythonExtension(vscodeExecutablePath: string, platform: DownloadPlatform) {
if (!requiresPythonExtensionToBeInstalled()) {
console.info('Python Extension not required');
return;
}
console.info(`Installing Python Extension ${PythonExtension} to ${extensionsDir}`);

const cliPath = resolveCliPathFromVSCodeExecutablePath(vscodeExecutablePath, platform);
spawnSync(cliPath, ['--install-extension', PythonExtension, '--pre-release', '--extensions-dir', extensionsDir], {
// console.log(`launching vscode to warm up: ${cliPath}`);
// const vscodeProc = spawn(cliPath, [], {
// stdio: 'inherit'
// });

// console.log(`waiting`);
// await new Promise((resolve) => setTimeout(resolve, 4000));
// console.log(`done waiting`);
// vscodeProc.kill('SIGKILL');
// vscodeProc.kill('SIGTERM');
// vscodeProc.on('exit', () => console.log(`vscode exited`));
// await new Promise((resolve) => setTimeout(resolve, 2000));
// console.log(`done waiting2`);

console.info(`Installing Python Extension ${PythonExtension}`);
spawnSync(
cliPath,
['--install-extension', PythonExtension, '--pre-release', '--log', 'trace', '--disable-telemetry'],
{
encoding: 'utf-8',
stdio: 'inherit'
}
);

// Make sure pylance is there too as we'll use it for intellisense tests
console.info(`Installing Pylance Extension`);
spawnSync(cliPath, ['--install-extension', PylanceExtension, '--log', 'trace', '--disable-telemetry'], {
encoding: 'utf-8',
stdio: 'inherit'
});

// Make sure pylance is there too as we'll use it for intellisense tests
console.info(`Installing Pylance Extension to ${extensionsDir}`);
spawnSync(cliPath, ['--install-extension', PylanceExtension, '--extensions-dir', extensionsDir], {
spawnSync('ls', ['-la', '/home/runner/.vscode-insiders/extensions'], {
encoding: 'utf-8',
stdio: 'inherit'
});
Expand Down Expand Up @@ -102,32 +126,14 @@ async function createSettings(): Promise<string> {
return userDataDirectory;
}

async function getExtensionsDir(): Promise<string> {
const name = 'vscode_jupyter_exts';
const extDirPath = path.join(tmp.tmpdir, name);
if (fs.existsSync(extDirPath)) {
return extDirPath;
}

return new Promise<string>((resolve, reject) => {
tmp.dir({ name, keep: true }, (err, dir) => {
if (err) {
return reject(err);
}
resolve(dir);
});
});
}

async function start() {
console.log('*'.repeat(100));
console.log('Start Standard tests');
const platform = computePlatform();
const vscodeExecutablePath = await downloadAndUnzipVSCode(channel, platform);
const baseLaunchArgs = requiresPythonExtensionToBeInstalled() ? [] : ['--disable-extensions'];
const userDataDirectory = await createSettings();
const extensionsDir = await getExtensionsDir();
await installPythonExtension(vscodeExecutablePath, extensionsDir, platform);
await installPythonExtension(vscodeExecutablePath, platform);
await runTests({
vscodeExecutablePath,
extensionDevelopmentPath: extensionDevelopmentPath,
Expand All @@ -138,7 +144,7 @@ async function start() {
.concat(['--skip-release-notes'])
.concat(['--enable-proposed-api'])
.concat(['--timeout', '5000'])
.concat(['--extensions-dir', extensionsDir])
// .concat(['--log', 'trace'])
.concat(['--user-data-dir', userDataDirectory]),
// .concat(['--verbose']), // Too much logging from VS Code, enable this to see what's going on in VSC.
version: channel,
Expand Down