Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python: Handle explicit PyPI source in pyproject.toml #7499

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions python/lib/dependabot/python/update_checker/index_finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ def pyproject_index_urls
[]

sources.each do |source|
# If source is PyPI, skip it, and let it pick the default URI
next if source["name"].casecmp?("PyPI")

if source["default"]
urls[:main] = source["url"]
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,20 @@
end
end

context "set pypi explicitly in a pyproject.toml" do
let(:pyproject_fixture_name) { "pypi_explicit.toml" }
let(:dependency_files) { [pyproject] }

it { is_expected.to eq(["https://pypi.org/simple/"]) }
end

context "set pypi explicitly in a pyproject.toml, in lowercase" do
let(:pyproject_fixture_name) { "pypi_explicit_lowercase.toml" }
let(:dependency_files) { [pyproject] }

it { is_expected.to eq(["https://pypi.org/simple/"]) }
end

context "set in credentials" do
let(:credentials) do
[{
Expand Down
16 changes: 16 additions & 0 deletions python/spec/fixtures/pyproject_files/pypi_explicit.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[tool.poetry]
name = "PythonProjects"
version = "2.0.0"
homepage = "https://github.com/roghu/py3_projects"
license = "MIT"
readme = "README.md"
authors = ["Dependabot <support@dependabot.com>"]
description = "Various small python projects."

[tool.poetry.dependencies]
python = "^3.7"
requests = "2.18.0"

[[tool.poetry.source]]
name = "PyPI"
priority = "primary"
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[tool.poetry]
name = "PythonProjects"
version = "2.0.0"
homepage = "https://github.com/roghu/py3_projects"
license = "MIT"
readme = "README.md"
authors = ["Dependabot <support@dependabot.com>"]
description = "Various small python projects."

[tool.poetry.dependencies]
python = "^3.7"
requests = "2.18.0"

[[tool.poetry.source]]
name = "pypi"
priority = "primary"