Skip to content

Commit

Permalink
Poetry: keep querying pypi.org even if we find other registries.
Browse files Browse the repository at this point in the history
  • Loading branch information
gilbsgilbs committed Sep 21, 2019
1 parent 324301a commit 93c072d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/manager/poetry/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ function extractFromSection(

function extractRegistries(pyprojectfile: PoetryFile): string[] {
const sources = pyprojectfile.tool.poetry.source;
const registryUrls: string[] = ['https://pypi.org/pypi/'];

if (!Array.isArray(sources)) {
return [];
return registryUrls;
}

const registryUrls: string[] = [];
for (const source of sources) {
if (source.url) {
registryUrls.push(source.url);
Expand Down
13 changes: 13 additions & 0 deletions test/manager/poetry/__snapshots__/extract.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`lib/manager/poetry/extract extractPackageFile() can parse empty registries 1`] = `
Array [
"https://pypi.org/pypi/",
]
`;

exports[`lib/manager/poetry/extract extractPackageFile() can parse missing registries 1`] = `
Array [
"https://pypi.org/pypi/",
]
`;

exports[`lib/manager/poetry/extract extractPackageFile() extracts multiple dependencies (with dep = {version = "1.2.3"} case) 1`] = `
Array [
Object {
Expand Down Expand Up @@ -159,6 +171,7 @@ Array [

exports[`lib/manager/poetry/extract extractPackageFile() extracts registries 1`] = `
Array [
"https://pypi.org/pypi/",
"https://foo.bar/simple/",
"https://bar.baz/+simple/",
]
Expand Down
8 changes: 5 additions & 3 deletions test/manager/poetry/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,17 @@ describe('lib/manager/poetry/extract', () => {
it('extracts registries', () => {
const res = extractPackageFile(pyproject6toml, config);
expect(res.registryUrls).toMatchSnapshot();
expect(res.registryUrls).toHaveLength(2);
expect(res.registryUrls).toHaveLength(3);
});
it('can parse empty registries', () => {
const res = extractPackageFile(pyproject7toml, config);
expect(res.registryUrls).toEqual([]);
expect(res.registryUrls).toMatchSnapshot();
expect(res.registryUrls).toHaveLength(1);
});
it('can parse missing registries', () => {
const res = extractPackageFile(pyproject1toml, config);
expect(res.registryUrls).toEqual([]);
expect(res.registryUrls).toMatchSnapshot();
expect(res.registryUrls).toHaveLength(1);
});
it('skips git dependencies', () => {
const content =
Expand Down

0 comments on commit 93c072d

Please sign in to comment.