@@ -3,7 +3,7 @@ import * as sinon from 'sinon';
33import { LogOutputChannel } from 'vscode' ;
44import * as persistentState from '../../../common/persistentState' ;
55import * as workspaceApis from '../../../common/workspace.apis' ;
6- import * as helpers from '../../../managers/builtin/helpers' ;
6+ import { resetUvInstallationCache , shouldUseUv } from '../../../managers/builtin/helpers' ;
77import * as uvEnvironments from '../../../managers/builtin/uvEnvironments' ;
88
99interface MockWorkspaceConfig {
@@ -18,12 +18,11 @@ suite('Helpers - shouldUseUv', () => {
1818 let mockLog : LogOutputChannel ;
1919 let getWorkspacePersistentStateStub : sinon . SinonStub ;
2020 let mockPersistentState : { get : sinon . SinonStub ; set : sinon . SinonStub ; clear : sinon . SinonStub } ;
21- let isUvInstalledStub : sinon . SinonStub ;
2221 let getUvEnvironmentsStub : sinon . SinonStub ;
2322
2423 setup ( ( ) => {
2524 // Reset UV installation cache before each test to ensure clean state
26- helpers . resetUvInstallationCache ( ) ;
25+ resetUvInstallationCache ( ) ;
2726
2827 mockGetConfiguration = sinon . stub ( workspaceApis , 'getConfiguration' ) ;
2928 mockConfig = {
@@ -43,7 +42,6 @@ suite('Helpers - shouldUseUv', () => {
4342 getWorkspacePersistentStateStub . returns ( Promise . resolve ( mockPersistentState ) ) ;
4443
4544 // Mock UV-related functions
46- isUvInstalledStub = sinon . stub ( helpers , 'isUvInstalled' ) ;
4745 getUvEnvironmentsStub = sinon . stub ( uvEnvironments , 'getUvEnvironments' ) ;
4846
4947 // No default behaviors set - each test configures what it needs
@@ -82,11 +80,11 @@ suite('Helpers - shouldUseUv', () => {
8280 mockConfig . get . withArgs ( 'alwaysUseUv' , true ) . returns ( true ) ;
8381 mockConfig . get . withArgs ( 'alwaysUseUv' ) . returns ( true ) ;
8482 mockConfig . inspect . withArgs ( 'alwaysUseUv' ) . returns ( mockInspectResult ) ;
85- isUvInstalledStub . resolves ( true ) ;
83+
8684 getUvEnvironmentsStub . resolves ( [ ] ) ;
8785
8886 // Run
89- const result = await helpers . shouldUseUv ( mockLog ) ;
87+ const result = await shouldUseUv ( mockLog ) ;
9088
9189 // Assert - Should return true when setting is true and UV is installed
9290 assert . strictEqual ( result , true ) ;
@@ -98,7 +96,7 @@ suite('Helpers - shouldUseUv', () => {
9896 getUvEnvironmentsStub . resolves ( [ ] ) ;
9997
10098 // Run
101- const result = await helpers . shouldUseUv ( mockLog ) ;
99+ const result = await shouldUseUv ( mockLog ) ;
102100
103101 // Assert - Should not use UV when setting is false
104102 assert . strictEqual ( result , false ) ;
@@ -108,11 +106,10 @@ suite('Helpers - shouldUseUv', () => {
108106 // Mock - UV environments list with test path and UV is installed
109107 const uvEnvPath = '/path/to/uv/env' ;
110108 getUvEnvironmentsStub . resolves ( [ uvEnvPath ] ) ;
111- isUvInstalledStub . resolves ( true ) ;
112109 mockConfig . get . withArgs ( 'alwaysUseUv' , true ) . returns ( false ) ;
113110
114111 // Run
115- const result = await helpers . shouldUseUv ( mockLog , uvEnvPath ) ;
112+ const result = await shouldUseUv ( mockLog , uvEnvPath ) ;
116113
117114 // Assert - Should return true for UV environments when UV is installed
118115 assert . strictEqual ( result , true ) ;
@@ -125,7 +122,7 @@ suite('Helpers - shouldUseUv', () => {
125122 getUvEnvironmentsStub . resolves ( [ ] ) ;
126123
127124 // Run
128- const result = await helpers . shouldUseUv ( mockLog , nonUvEnvPath ) ;
125+ const result = await shouldUseUv ( mockLog , nonUvEnvPath ) ;
129126
130127 // Assert - Should not use UV for non-UV environments when setting is false
131128 assert . strictEqual ( result , false ) ;
@@ -135,11 +132,10 @@ suite('Helpers - shouldUseUv', () => {
135132 // Mock - Non-UV environment, alwaysUseUv is true, UV is installed
136133 const nonUvEnvPath = '/path/to/regular/env' ;
137134 mockConfig . get . withArgs ( 'alwaysUseUv' , true ) . returns ( true ) ;
138- isUvInstalledStub . resolves ( true ) ;
139135 getUvEnvironmentsStub . resolves ( [ ] ) ;
140136
141137 // Run
142- const result = await helpers . shouldUseUv ( mockLog , nonUvEnvPath ) ;
138+ const result = await shouldUseUv ( mockLog , nonUvEnvPath ) ;
143139
144140 // Assert - Should return true when alwaysUseUv is true and UV is installed
145141 assert . strictEqual ( result , true ) ;
@@ -148,11 +144,10 @@ suite('Helpers - shouldUseUv', () => {
148144 test ( 'should use default value true when alwaysUseUv setting is not configured' , async ( ) => {
149145 // Mock - Setting not configured, should use default of true, UV is installed
150146 mockConfig . get . withArgs ( 'alwaysUseUv' , true ) . returns ( true ) ;
151- isUvInstalledStub . resolves ( true ) ;
152147 getUvEnvironmentsStub . resolves ( [ ] ) ;
153148
154149 // Run
155- const result = await helpers . shouldUseUv ( mockLog ) ;
150+ const result = await shouldUseUv ( mockLog ) ;
156151
157152 // Assert - Should return true with default setting when UV is installed
158153 assert . strictEqual ( result , true ) ;
@@ -164,7 +159,7 @@ suite('Helpers - shouldUseUv', () => {
164159 getUvEnvironmentsStub . resolves ( [ ] ) ;
165160
166161 // Run
167- const result = await helpers . shouldUseUv ( mockLog ) ;
162+ const result = await shouldUseUv ( mockLog ) ;
168163
169164 // Assert - Should not use UV when setting is false
170165 assert . strictEqual ( result , false ) ;
0 commit comments