Skip to content

Commit

Permalink
fix(poetry): support pin for short versions (#19543)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Dec 23, 2022
1 parent 7d6a481 commit f5548af
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/modules/versioning/poetry/index.spec.ts
Expand Up @@ -226,6 +226,7 @@ describe('modules/versioning/poetry/index', () => {
${'~1.2'} | ${'replace'} | ${'1.2.3'} | ${'2.0.0'} | ${'~2.0'}
${'~1'} | ${'replace'} | ${'1.2.3'} | ${'2.0.0'} | ${'~2'}
${'^2.2'} | ${'widen'} | ${'2.2.0'} | ${'3.0.0'} | ${'^2.2 || ^3.0.0'}
${'^3.5'} | ${'pin'} | ${'3.5'} | ${'3.5'} | ${'3.5'}
`(
'getNewValue("$currentValue", "$rangeStrategy", "$currentVersion", "$newVersion") === "$expected"',
({ currentValue, rangeStrategy, currentVersion, newVersion, expected }) => {
Expand Down
3 changes: 3 additions & 0 deletions lib/modules/versioning/poetry/index.ts
Expand Up @@ -150,6 +150,9 @@ function getNewValue({
currentVersion,
newVersion,
}: NewValueConfig): string {
if (rangeStrategy === 'pin') {
return newVersion;
}
if (rangeStrategy === 'replace') {
const npmCurrentValue = poetry2npm(currentValue);
try {
Expand Down

0 comments on commit f5548af

Please sign in to comment.