Skip to content

Commit

Permalink
Don't bail out on files without dependencies field
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Sep 15, 2022
1 parent 87bc7e1 commit eaddce8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def initialize(dependency_files:)
def dependency_set
dependency_set = Dependabot::FileParsers::Base::DependencySet.new

dependency_set += pyproject_dependencies
dependency_set += pyproject_dependencies if using_poetry? || using_pep621?
dependency_set += lockfile_dependencies if lockfile

dependency_set
Expand All @@ -38,7 +38,7 @@ def dependency_set
def pyproject_dependencies
if using_poetry?
poetry_dependencies
elsif using_pep621?
else
pep621_dependencies
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,14 @@
end
end

context "without dependencies" do
let(:pyproject_fixture_name) { "no_dependencies.toml" }

subject(:dependencies) { parser.dependency_set.dependencies }

its(:length) { is_expected.to eq(0) }
end

context "with dependencies with empty requirements" do
let(:pyproject_fixture_name) { "no_requirements.toml" }

Expand Down
10 changes: 10 additions & 0 deletions python/spec/fixtures/pyproject_files/no_dependencies.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[build-system]
requires = ["flit_core >=3.2,<4"]
build-backend = "flit_core.buildapi"

[project]
name = "pkgtest"
authors = [{name = "Sample", email = "sample.project@example.org"}]
license = {file = "LICENSE"}
classifiers = ["License :: OSI Approved :: MIT License"]
dynamic = ["version", "description"]

0 comments on commit eaddce8

Please sign in to comment.