File tree 3 files changed +22
-2
lines changed
Filter options
3 files changed +22
-2
lines changed
Original file line number Diff line number Diff line change
1
+ [tools ]
2
+ python = " 3.8.0"
Original file line number Diff line number Diff line change @@ -130,6 +130,18 @@ describe('Version from file test', () => {
130
130
expect ( _fn ( pythonVersionFilePath ) ) . toEqual ( [ pythonVersion ] ) ;
131
131
}
132
132
) ;
133
+ it . each ( [ getVersionInputFromTomlFile , getVersionInputFromFile ] ) (
134
+ 'Version from mise mise.tml test' ,
135
+ async _fn => {
136
+ await io . mkdirP ( tempDir ) ;
137
+ const pythonVersionFileName = 'mise.toml' ;
138
+ const pythonVersionFilePath = path . join ( tempDir , pythonVersionFileName ) ;
139
+ const pythonVersion = '3.8.0' ;
140
+ const pythonVersionFileContent = `[tools]\npython = "${ pythonVersion } "` ;
141
+ fs . writeFileSync ( pythonVersionFilePath , pythonVersionFileContent ) ;
142
+ expect ( _fn ( pythonVersionFilePath ) ) . toEqual ( [ pythonVersion ] ) ;
143
+ }
144
+ ) ;
133
145
it . each ( [ getVersionInputFromTomlFile , getVersionInputFromFile ] ) (
134
146
'Version undefined' ,
135
147
async _fn => {
Original file line number Diff line number Diff line change @@ -235,15 +235,21 @@ export function getVersionInputFromTomlFile(versionFile: string): string[] {
235
235
pyprojectFile = pyprojectFile . replace ( / \r \n / g, '\n' ) ;
236
236
237
237
const pyprojectConfig = toml . parse ( pyprojectFile ) ;
238
- let keys = [ ] ;
238
+ let keys : string [ ] = [ ] ;
239
239
240
240
if ( 'project' in pyprojectConfig ) {
241
241
// standard project metadata (PEP 621)
242
242
keys = [ 'project' , 'requires-python' ] ;
243
- } else {
243
+ }
244
+ else if ( 'tool' in pyprojectConfig ) {
244
245
// python poetry
245
246
keys = [ 'tool' , 'poetry' , 'dependencies' , 'python' ] ;
246
247
}
248
+ else if ( 'tools' in pyprojectConfig ) {
249
+ // mise
250
+ keys = [ 'tools' , 'python' ]
251
+ }
252
+
247
253
const versions = [ ] ;
248
254
const version = extractValue ( pyprojectConfig , keys ) ;
249
255
if ( version !== undefined ) {
You can’t perform that action at this time.
0 commit comments