Skip to content

Tests failing on main #18338

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

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
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ src/test/common/process/decoder.test.ts
src/test/common/process/processFactory.unit.test.ts
src/test/common/process/pythonToolService.unit.test.ts
src/test/common/process/proc.observable.test.ts
src/test/common/process/pythonProc.simple.multiroot.test.ts
src/test/common/process/logger.unit.test.ts
src/test/common/process/proc.exec.test.ts
src/test/common/process/pythonProcess.unit.test.ts
Expand Down
51 changes: 41 additions & 10 deletions src/test/common/process/pythonProc.simple.multiroot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ import { IConfigurationService } from '../../../client/common/types';
import { clearCache } from '../../../client/common/utils/cacheUtils';
import { OSType } from '../../../client/common/utils/platform';
import { IServiceContainer } from '../../../client/ioc/types';
import { clearPythonPathInWorkspaceFolder, isOs, isPythonVersion } from '../../common';
import { initializeExternalDependencies } from '../../../client/pythonEnvironments/common/externalDependencies';
import { clearPythonPathInWorkspaceFolder, isOs } from '../../common';
import { getExtensionSettings } from '../../extensionSettings';
import { closeActiveWindows, initialize, initializeTest, IS_MULTI_ROOT_TEST } from './../../initialize';
import { closeActiveWindows, initialize, initializeTest, IS_MULTI_ROOT_TEST } from '../../initialize';

use(chaiAsPromised);

Expand All @@ -36,6 +37,7 @@ suite('PythonExecutableService', () => {
}
await clearPythonPathInWorkspaceFolder(workspace4Path);
serviceContainer = (await initialize()).serviceContainer;
initializeExternalDependencies(serviceContainer);
});
setup(async () => {
configService = serviceContainer.get<IConfigurationService>(IConfigurationService);
Expand All @@ -54,7 +56,12 @@ suite('PythonExecutableService', () => {
clearCache();
});

test('Importing without a valid PYTHONPATH should fail', async () => {
test('Importing without a valid PYTHONPATH should fail', async function () {
// Timing out on Windows, tracked by #18337.
if (isOs(OSType.Windows)) {
return this.skip();
}

await configService.updateSetting(
'envFile',
'someInvalidFile.env',
Expand All @@ -69,12 +76,13 @@ suite('PythonExecutableService', () => {
});

await expect(promise).to.eventually.be.rejectedWith(StdErrError);

return undefined;
});

test('Importing with a valid PYTHONPATH from .env file should succeed', async function () {
// This test has not been working for many months in Python 2.7 under
// Windows. Tracked by #2547.
if (isOs(OSType.Windows) && (await isPythonVersion('2.7'))) {
// Timing out on Windows, tracked by #18337.
if (isOs(OSType.Windows)) {
return this.skip();
}

Expand All @@ -86,28 +94,49 @@ suite('PythonExecutableService', () => {
});

await expect(promise).to.eventually.have.property('stdout', `Hello${EOL}`);

return undefined;
});

test("Known modules such as 'os' and 'sys' should be deemed 'installed'", async () => {
test("Known modules such as 'os' and 'sys' should be deemed 'installed'", async function () {
// Timing out on Windows, tracked by #18337.
if (isOs(OSType.Windows)) {
return this.skip();
}

const pythonExecService = await pythonExecFactory.create({ resource: workspace4PyFile });
const osModuleIsInstalled = pythonExecService.isModuleInstalled('os');
const sysModuleIsInstalled = pythonExecService.isModuleInstalled('sys');
await expect(osModuleIsInstalled).to.eventually.equal(true, 'os module is not installed');
await expect(sysModuleIsInstalled).to.eventually.equal(true, 'sys module is not installed');

return undefined;
});

test("Unknown modules such as 'xyzabc123' be deemed 'not installed'", async () => {
test("Unknown modules such as 'xyzabc123' be deemed 'not installed'", async function () {
// Timing out on Windows, tracked by #18337.
if (isOs(OSType.Windows)) {
return this.skip();
}

const pythonExecService = await pythonExecFactory.create({ resource: workspace4PyFile });
const randomModuleName = `xyz123${new Date().getSeconds()}`;
const randomModuleIsInstalled = pythonExecService.isModuleInstalled(randomModuleName);
await expect(randomModuleIsInstalled).to.eventually.equal(
false,
`Random module '${randomModuleName}' is installed`,
);

return undefined;
});

test('Ensure correct path to executable is returned', async () => {
const pythonPath = getExtensionSettings(workspace4Path).pythonPath;
test('Ensure correct path to executable is returned', async function () {
// Timing out on Windows, tracked by #18337.
if (isOs(OSType.Windows)) {
return this.skip();
}

const { pythonPath } = getExtensionSettings(workspace4Path);
let expectedExecutablePath: string;
if (await fs.pathExists(pythonPath)) {
expectedExecutablePath = pythonPath;
Expand All @@ -121,5 +150,7 @@ suite('PythonExecutableService', () => {
const pythonExecService = await pythonExecFactory.create({ resource: workspace4PyFile });
const executablePath = await pythonExecService.getExecutablePath();
expect(executablePath).to.equal(expectedExecutablePath, 'Executable paths are not the same');

return undefined;
});
});
38 changes: 34 additions & 4 deletions src/test/linters/lint.multiroot.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import {
import { ProductService } from '../../client/common/installer/productService';
import { IProductPathService, IProductService } from '../../client/common/installer/types';
import { IConfigurationService, Product, ProductType } from '../../client/common/types';
import { OSType } from '../../client/common/utils/platform';
import { ILinter, ILinterManager } from '../../client/linters/types';
import { isOs } from '../common';
import { TEST_TIMEOUT } from '../constants';
import { closeActiveWindows, initialize, initializeTest, IS_MULTI_ROOT_TEST } from '../initialize';
import { UnitTestIocContainer } from '../testing/serviceRegistry';
Expand Down Expand Up @@ -87,24 +89,52 @@ suite('Multiroot Linting', () => {
assert.strictEqual(messages.length > 0, mustHaveErrors, errorMessage);
}

test('Enabling Pylint in root and also in Workspace, should return errors', async () => {
test('Enabling Pylint in root and also in Workspace, should return errors', async function () {
// Timing out on Windows, tracked by #18337.
if (isOs(OSType.Windows)) {
return this.skip();
}

await runTest(Product.pylint, true, true, pylintSetting);

return undefined;
}).timeout(TEST_TIMEOUT * 2);
test('Enabling Pylint in root and disabling in Workspace, should not return errors', async () => {
await runTest(Product.pylint, true, false, pylintSetting);
}).timeout(TEST_TIMEOUT * 2);
test('Disabling Pylint in root and enabling in Workspace, should return errors', async () => {
test('Disabling Pylint in root and enabling in Workspace, should return errors', async function () {
// Timing out on Windows, tracked by #18337.
if (isOs(OSType.Windows)) {
return this.skip();
}

await runTest(Product.pylint, false, true, pylintSetting);

return undefined;
}).timeout(TEST_TIMEOUT * 2);

test('Enabling Flake8 in root and also in Workspace, should return errors', async () => {
test('Enabling Flake8 in root and also in Workspace, should return errors', async function () {
// Timing out on Windows, tracked by #18337.
if (isOs(OSType.Windows)) {
return this.skip();
}

await runTest(Product.flake8, true, true, flake8Setting);

return undefined;
}).timeout(TEST_TIMEOUT * 2);
test('Enabling Flake8 in root and disabling in Workspace, should not return errors', async () => {
await runTest(Product.flake8, true, false, flake8Setting);
}).timeout(TEST_TIMEOUT * 2);
test('Disabling Flake8 in root and enabling in Workspace, should return errors', async () => {
test('Disabling Flake8 in root and enabling in Workspace, should return errors', async function () {
// Timing out on Windows, tracked by #18337.
if (isOs(OSType.Windows)) {
return this.skip();
}

await runTest(Product.flake8, false, true, flake8Setting);

return undefined;
}).timeout(TEST_TIMEOUT * 2);

async function runTest(product: Product, global: boolean, wks: boolean, setting: string): Promise<void> {
Expand Down