Skip to content

Commit

Permalink
Fix broken specs
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Oct 21, 2022
1 parent 00a3fda commit d140db7
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
4 changes: 2 additions & 2 deletions python/helpers/lib/parser.py
Expand Up @@ -54,9 +54,9 @@ def version_from_req(specifier_set):
project_toml['dependencies']
)

optional_dependencies_toml = project_toml['optional-dependencies']
if 'optional-dependencies' in project_toml:
optional_dependencies_toml = project_toml['optional-dependencies']

if optional_dependencies_toml:
for group in optional_dependencies_toml:
group_dependencies = parse_toml_section_pep621_dependencies(
pyproject_path,
Expand Down
Expand Up @@ -289,5 +289,15 @@

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

context "with optional dependencies" do
let(:pyproject_fixture_name) { "optional_dependencies.toml" }

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

# fixture has 1 runtime dependency, plus 4 optional dependencies, but one
# is ignored because it has markers
its(:length) { is_expected.to eq(4) }
end
end
end
21 changes: 21 additions & 0 deletions python/spec/fixtures/pyproject_files/optional_dependencies.toml
@@ -0,0 +1,21 @@
[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"]
dependencies = [
"ansys-templates==0.3.0",
]

[project.optional-dependencies]
socks = [ 'PySocks >= 1.5.6, != 1.5.7, < 2' ]
tests = [
'ddt >= 1.2.2, < 2',
'pytest < 6',
'mock >= 1.0.1, < 4; python_version < "3.4"',
]
8 changes: 0 additions & 8 deletions python/spec/fixtures/pyproject_files/standard_python.toml
Expand Up @@ -11,11 +11,3 @@ dynamic = ["version", "description"]
dependencies = [
"ansys-templates==0.3.0",
]

[project.optional-dependencies]
socks = [ 'PySocks >= 1.5.6, != 1.5.7, < 2' ]
tests = [
'ddt >= 1.2.2, < 2',
'pytest < 6',
'mock >= 1.0.1, < 4; python_version < "3.4"',
]

0 comments on commit d140db7

Please sign in to comment.