From e20345f3b8bf29f75c5f675701dbcbdf9ad3b85a Mon Sep 17 00:00:00 2001 From: Karthik Nadig Date: Thu, 17 Oct 2024 21:09:04 -0700 Subject: [PATCH] Fix testing adapter tests --- src/test/testing/common/testingAdapter.test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/test/testing/common/testingAdapter.test.ts b/src/test/testing/common/testingAdapter.test.ts index dcd45b2e56bc..8a1891962429 100644 --- a/src/test/testing/common/testingAdapter.test.ts +++ b/src/test/testing/common/testingAdapter.test.ts @@ -7,6 +7,7 @@ import * as path from 'path'; import * as assert from 'assert'; import * as fs from 'fs'; import * as os from 'os'; +import * as sinon from 'sinon'; import { PytestTestDiscoveryAdapter } from '../../../client/testing/testController/pytest/pytestDiscoveryAdapter'; import { ITestController, ITestResultResolver } from '../../../client/testing/testController/common/types'; import { IPythonExecutionFactory } from '../../../client/common/process/types'; @@ -22,6 +23,7 @@ import { TestProvider } from '../../../client/testing/types'; import { PYTEST_PROVIDER, UNITTEST_PROVIDER } from '../../../client/testing/common/constants'; import { IEnvironmentVariablesProvider } from '../../../client/common/variables/types'; import { createTypeMoq } from '../../mocks/helper'; +import * as pixi from '../../../client/pythonEnvironments/common/environmentManagers/pixi'; suite('End to End Tests: test adapters', () => { let resultResolver: ITestResultResolver; @@ -32,6 +34,7 @@ suite('End to End Tests: test adapters', () => { let workspaceUri: Uri; let testOutputChannel: typeMoq.IMock; let testController: TestController; + let getPixiStub: sinon.SinonStub; const unittestProvider: TestProvider = UNITTEST_PROVIDER; const pytestProvider: TestProvider = PYTEST_PROVIDER; const rootPathSmallWorkspace = path.join( @@ -104,6 +107,9 @@ suite('End to End Tests: test adapters', () => { }); setup(async () => { + getPixiStub = sinon.stub(pixi, 'getPixi'); + getPixiStub.resolves(undefined); + // create objects that were injected configService = serviceContainer.get(IConfigurationService); pythonExecFactory = serviceContainer.get(IPythonExecutionFactory); @@ -130,6 +136,9 @@ suite('End to End Tests: test adapters', () => { // Whatever you need to return }); }); + teardown(() => { + sinon.restore(); + }); suiteTeardown(async () => { // remove symlink const dest = rootPathDiscoverySymlink;