mirror of
https://github.com/actions/setup-python.git
synced 2025-07-01 23:23:46 +00:00
Add support to .tool-version file format
Create a function to parse tool-version (asdf-vm) format, add the associated tests, and updated the documentation Ticket-ID: #571
This commit is contained in:
parent
bd6b4b6205
commit
892baae68b
4 changed files with 47 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
|||
import * as cache from '@actions/cache';
|
||||
import * as core from '@actions/core';
|
||||
import {
|
||||
parsePythonVersionFile,
|
||||
validateVersion,
|
||||
validatePythonVersionFormatForPyPy,
|
||||
isCacheFeatureAvailable
|
||||
|
@ -9,6 +10,20 @@ import {
|
|||
jest.mock('@actions/cache');
|
||||
jest.mock('@actions/core');
|
||||
|
||||
describe('parsePythonVersionFile', () => {
|
||||
it('handle the content of a .python-version file', () => {
|
||||
expect(parsePythonVersionFile('3.6')).toEqual('3.6')
|
||||
});
|
||||
|
||||
it('trims extra spaces at the end of the content', () => {
|
||||
expect(parsePythonVersionFile('3.7 ')).toEqual('3.7')
|
||||
});
|
||||
|
||||
it('parses correctly the content of .tool-version files', () => {
|
||||
expect(parsePythonVersionFile('python 3.7')).toEqual('3.7')
|
||||
});
|
||||
});
|
||||
|
||||
describe('validatePythonVersionFormatForPyPy', () => {
|
||||
it.each([
|
||||
['3.6', true],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue