Skip to content

Commit 9544332

Browse files
committed
formatting
1 parent 1345d61 commit 9544332

File tree

2 files changed

+36
-29
lines changed

2 files changed

+36
-29
lines changed

src/test/testing/configuration/pytestInstallationHelper.unit.test.ts

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ suite('PytestInstallationHelper', () => {
2121
setup(() => {
2222
appShell = TypeMoq.Mock.ofType<IApplicationShell>();
2323
helper = new PytestInstallationHelper(appShell.object);
24-
24+
2525
useEnvExtensionStub = sinon.stub(envExtApi, 'useEnvExtension');
2626
getEnvExtApiStub = sinon.stub(envExtApi, 'getEnvExtApi');
2727
getEnvironmentStub = sinon.stub(envExtApi, 'getEnvironment');
@@ -57,16 +57,16 @@ suite('PytestInstallationHelper', () => {
5757

5858
test('isEnvExtensionAvailable should return result from useEnvExtension', () => {
5959
useEnvExtensionStub.returns(true);
60-
60+
6161
const result = helper.isEnvExtensionAvailable();
62-
62+
6363
expect(result).to.be.true;
6464
expect(useEnvExtensionStub.calledOnce).to.be.true;
6565
});
6666

6767
test('promptToInstallPytest should return false if env extension not available', async () => {
6868
useEnvExtensionStub.returns(false);
69-
69+
7070
appShell
7171
.setup((a) => a.showInformationMessage(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()))
7272
.returns(() => Promise.resolve('Install pytest'))
@@ -80,24 +80,26 @@ suite('PytestInstallationHelper', () => {
8080

8181
test('promptToInstallPytest should attempt installation when env extension is available', async () => {
8282
useEnvExtensionStub.returns(true);
83-
83+
8484
const mockEnvironment = { envId: { id: 'test-env', managerId: 'test-manager' } };
8585
const mockEnvExtApi = {
86-
managePackages: sinon.stub().resolves()
86+
managePackages: sinon.stub().resolves(),
8787
};
88-
88+
8989
getEnvExtApiStub.resolves(mockEnvExtApi);
9090
getEnvironmentStub.resolves(mockEnvironment);
91-
91+
9292
appShell
93-
.setup((a) => a.showInformationMessage(
94-
TypeMoq.It.is((msg: string) => msg.includes('pytest selected but not installed')),
95-
TypeMoq.It.isAny(),
96-
TypeMoq.It.isAny()
97-
))
93+
.setup((a) =>
94+
a.showInformationMessage(
95+
TypeMoq.It.is((msg: string) => msg.includes('pytest selected but not installed')),
96+
TypeMoq.It.isAny(),
97+
TypeMoq.It.isAny(),
98+
),
99+
)
98100
.returns(() => Promise.resolve('Install pytest'))
99101
.verifiable(TypeMoq.Times.once());
100-
102+
101103
appShell
102104
.setup((a) => a.showInformationMessage(TypeMoq.It.is((msg: string) => msg.includes('successfully'))))
103105
.returns(() => Promise.resolve(undefined))
@@ -109,4 +111,4 @@ suite('PytestInstallationHelper', () => {
109111
expect(mockEnvExtApi.managePackages.calledOnceWithExactly(mockEnvironment, { install: ['pytest'] })).to.be.true;
110112
appShell.verifyAll();
111113
});
112-
});
114+
});

src/test/testing/testController/common/buildErrorNodeOptions.unit.test.ts

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,43 @@ suite('buildErrorNodeOptions - pytest not installed detection', () => {
99
const workspaceUri = Uri.file('/test/workspace');
1010

1111
test('Should detect pytest ModuleNotFoundError and provide specific message', () => {
12-
const errorMessage = 'Traceback (most recent call last):\n File "<string>", line 1, in <module>\n import pytest\nModuleNotFoundError: No module named \'pytest\'';
13-
12+
const errorMessage =
13+
'Traceback (most recent call last):\n File "<string>", line 1, in <module>\n import pytest\nModuleNotFoundError: No module named \'pytest\'';
14+
1415
const result = buildErrorNodeOptions(workspaceUri, errorMessage, 'pytest');
15-
16+
1617
expect(result.label).to.equal('pytest Not Installed [workspace]');
17-
expect(result.error).to.equal('pytest is not installed in the selected Python environment. Please install pytest to enable test discovery and execution.');
18+
expect(result.error).to.equal(
19+
'pytest is not installed in the selected Python environment. Please install pytest to enable test discovery and execution.',
20+
);
1821
});
1922

2023
test('Should detect pytest ImportError and provide specific message', () => {
2124
const errorMessage = 'ImportError: No module named pytest';
22-
25+
2326
const result = buildErrorNodeOptions(workspaceUri, errorMessage, 'pytest');
24-
27+
2528
expect(result.label).to.equal('pytest Not Installed [workspace]');
26-
expect(result.error).to.equal('pytest is not installed in the selected Python environment. Please install pytest to enable test discovery and execution.');
29+
expect(result.error).to.equal(
30+
'pytest is not installed in the selected Python environment. Please install pytest to enable test discovery and execution.',
31+
);
2732
});
2833

2934
test('Should use generic error for non-pytest-related errors', () => {
3035
const errorMessage = 'Some other error occurred';
31-
36+
3237
const result = buildErrorNodeOptions(workspaceUri, errorMessage, 'pytest');
33-
38+
3439
expect(result.label).to.equal('pytest Discovery Error [workspace]');
3540
expect(result.error).to.equal('Some other error occurred');
3641
});
3742

3843
test('Should use generic error for unittest errors', () => {
39-
const errorMessage = 'ModuleNotFoundError: No module named \'pytest\'';
40-
44+
const errorMessage = "ModuleNotFoundError: No module named 'pytest'";
45+
4146
const result = buildErrorNodeOptions(workspaceUri, errorMessage, 'unittest');
42-
47+
4348
expect(result.label).to.equal('Unittest Discovery Error [workspace]');
44-
expect(result.error).to.equal('ModuleNotFoundError: No module named \'pytest\'');
49+
expect(result.error).to.equal("ModuleNotFoundError: No module named 'pytest'");
4550
});
46-
});
51+
});

0 commit comments

Comments
 (0)