forked from renovatebot/renovate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(manager/poetry): support git rev dependencies (renovatebot#26367)
Co-authored-by: Sebastian Poxhofer <[email protected]> Co-authored-by: Michael Kriese <[email protected]>
- Loading branch information
Showing
4 changed files
with
142 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import { codeBlock } from 'common-tags'; | ||
import { Fixtures } from '../../../../test/fixtures'; | ||
import { fs } from '../../../../test/util'; | ||
import { GitRefsDatasource } from '../../datasource/git-refs'; | ||
import { GithubReleasesDatasource } from '../../datasource/github-releases'; | ||
import { GithubTagsDatasource } from '../../datasource/github-tags'; | ||
import { PypiDatasource } from '../../datasource/pypi'; | ||
import { extractPackageFile } from '.'; | ||
|
||
jest.mock('../../../util/fs'); | ||
|
@@ -169,6 +171,107 @@ describe('modules/manager/poetry/extract', () => { | |
}); | ||
}); | ||
|
||
it('parses git dependencies long commit hashs on http urls', async () => { | ||
const content = codeBlock` | ||
[tool.poetry.dependencies] | ||
fastapi = {git = "https://github.com/tiangolo/fastapi.git", rev="6f5aa81c076d22e38afbe7d602db6730e28bc3cc"} | ||
dep = "^2.0" | ||
`; | ||
const res = await extractPackageFile(content, filename); | ||
expect(res?.deps).toMatchObject([ | ||
{ | ||
depType: 'dependencies', | ||
depName: 'fastapi', | ||
datasource: GitRefsDatasource.id, | ||
currentDigest: '6f5aa81c076d22e38afbe7d602db6730e28bc3cc', | ||
replaceString: '6f5aa81c076d22e38afbe7d602db6730e28bc3cc', | ||
packageName: 'https://github.com/tiangolo/fastapi.git', | ||
}, | ||
{ | ||
depType: 'dependencies', | ||
depName: 'dep', | ||
datasource: PypiDatasource.id, | ||
currentValue: '^2.0', | ||
}, | ||
]); | ||
}); | ||
|
||
it('parses git dependencies short commit hashs on http urls', async () => { | ||
const content = codeBlock` | ||
[tool.poetry.dependencies] | ||
fastapi = {git = "https://github.com/tiangolo/fastapi.git", rev="6f5aa81"} | ||
dep = "^2.0" | ||
`; | ||
const res = await extractPackageFile(content, filename); | ||
expect(res?.deps).toMatchObject([ | ||
{ | ||
depType: 'dependencies', | ||
depName: 'fastapi', | ||
datasource: GitRefsDatasource.id, | ||
currentDigest: '6f5aa81', | ||
replaceString: '6f5aa81', | ||
packageName: 'https://github.com/tiangolo/fastapi.git', | ||
}, | ||
{ | ||
depType: 'dependencies', | ||
depName: 'dep', | ||
datasource: PypiDatasource.id, | ||
currentValue: '^2.0', | ||
}, | ||
]); | ||
}); | ||
|
||
it('parses git dependencies long commit hashs on ssh urls', async () => { | ||
const content = codeBlock` | ||
[tool.poetry.dependencies] | ||
fastapi = {git = "[email protected]:tiangolo/fastapi.git", rev="6f5aa81c076d22e38afbe7d602db6730e28bc3cc"} | ||
dep = "^2.0" | ||
`; | ||
const res = await extractPackageFile(content, filename); | ||
expect(res?.deps).toMatchObject([ | ||
{ | ||
depType: 'dependencies', | ||
depName: 'fastapi', | ||
datasource: GitRefsDatasource.id, | ||
currentDigest: '6f5aa81c076d22e38afbe7d602db6730e28bc3cc', | ||
replaceString: '6f5aa81c076d22e38afbe7d602db6730e28bc3cc', | ||
packageName: '[email protected]:tiangolo/fastapi.git', | ||
}, | ||
{ | ||
depType: 'dependencies', | ||
depName: 'dep', | ||
datasource: PypiDatasource.id, | ||
currentValue: '^2.0', | ||
}, | ||
]); | ||
}); | ||
|
||
it('parses git dependencies long commit hashs on http urls with branch marker', async () => { | ||
const content = codeBlock` | ||
[tool.poetry.dependencies] | ||
fastapi = {git = "https://github.com/tiangolo/fastapi.git", branch="develop", rev="6f5aa81c076d22e38afbe7d602db6730e28bc3cc"} | ||
dep = "^2.0" | ||
`; | ||
const res = await extractPackageFile(content, filename); | ||
expect(res?.deps).toMatchObject([ | ||
{ | ||
depType: 'dependencies', | ||
depName: 'fastapi', | ||
datasource: GitRefsDatasource.id, | ||
currentValue: 'develop', | ||
currentDigest: '6f5aa81c076d22e38afbe7d602db6730e28bc3cc', | ||
replaceString: '6f5aa81c076d22e38afbe7d602db6730e28bc3cc', | ||
packageName: 'https://github.com/tiangolo/fastapi.git', | ||
}, | ||
{ | ||
depType: 'dependencies', | ||
depName: 'dep', | ||
datasource: PypiDatasource.id, | ||
currentValue: '^2.0', | ||
}, | ||
]); | ||
}); | ||
|
||
it('parses github dependencies tags on ssh urls', async () => { | ||
const content = codeBlock` | ||
[tool.poetry.dependencies] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters