Skip to content

Commit f7fe643

Browse files
committed
fix listening
1 parent d8117e6 commit f7fe643

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/test/integration/pythonProjects.integration.test.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,21 @@ suite('Integration: Python Projects', function () {
162162

163163
const environments = await api.getEnvironments('all');
164164

165-
if (environments.length === 0) {
165+
if (environments.length < 2) {
166166
this.skip();
167167
return;
168168
}
169169

170170
const project = projects[0];
171-
const env = environments[0];
171+
172+
// Pick an environment different from the current one so setEnvironment
173+
// actually triggers a change event. If we pick the already-active env,
174+
// the event never fires and the test times out.
175+
const currentEnv = await api.getEnvironment(project.uri);
176+
let env = environments[0];
177+
if (currentEnv && currentEnv.envId.id === env.envId.id) {
178+
env = environments[1];
179+
}
172180

173181
// Wait for the change event, then verify getEnvironment.
174182
// Using an event-driven approach instead of polling avoids a race condition where

0 commit comments

Comments
 (0)