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

Investigate why watcher tests are failing #18415

Closed
wants to merge 4 commits into from
Closed
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
6 changes: 3 additions & 3 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ jobs:
matrix:
# We're not running CI on macOS for now because it's one less matrix entry to lower the number of runners used,
# macOS runners are expensive, and we assume that Ubuntu is enough to cover the Unix case.
os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest]
# Run the tests on the oldest and most recent versions of Python.
python: ['2.7', '3.x']
test-suite: [ts-unit, python-unit, venv, single-workspace, debugger, functional]
python: ['3.x']
test-suite: [venv]
exclude:
# For fast PR turn-around, skip 2.7 under Windows.
- os: windows-latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { FileChangeType } from '../../../../../client/common/platform/fileSystem
import { createDeferred, Deferred, sleep } from '../../../../../client/common/utils/async';
import { getOSType, OSType } from '../../../../../client/common/utils/platform';
import { IDisposable } from '../../../../../client/common/utils/resourceLifecycle';
import { StopWatch } from '../../../../../client/common/utils/stopWatch';
import { traceWarn } from '../../../../../client/logging';
import { PythonEnvKind } from '../../../../../client/pythonEnvironments/base/info';
import { BasicEnvInfo, ILocator } from '../../../../../client/pythonEnvironments/base/locator';
Expand Down Expand Up @@ -139,10 +140,12 @@ export function testLocatorWatcher(
const venvs = new Venvs(root);

async function waitForChangeToBeDetected(deferred: Deferred<void>) {
const stopwatch = new StopWatch();
const timeout = setTimeout(() => {
clearTimeout(timeout);
console.log('Time taken venv', stopwatch.elapsedTime);
deferred.reject(new Error('Environment not detected'));
}, TEST_TIMEOUT);
}, TEST_TIMEOUT * 2);
await deferred.promise;
}

Expand All @@ -151,10 +154,7 @@ export function testLocatorWatcher(
return items.some((item) => externalDeps.arePathsSame(item.executablePath, executable));
}

suiteSetup(async function () {
if (getOSType() === OSType.Linux) {
this.skip();
}
suiteSetup(async () => {
await venvs.cleanUp();
});
async function setupLocator(onChanged: (e: PythonEnvsChangedEvent) => Promise<void>) {
Expand All @@ -180,7 +180,7 @@ export function testLocatorWatcher(
deferred.resolve();
});

const { executable, envDir } = await venvs.create('one');
const { executable, envDir } = await venvs.createDummyEnv('one', PythonEnvKind.Venv);
await waitForChangeToBeDetected(deferred);
if (!options?.doNotVerifyIfLocated) {
const isFound = await isLocated(executable);
Expand Down