Skip to content

Commit

Permalink
fix (masonry.api): get_requires_for_build_wheel must return additio…
Browse files Browse the repository at this point in the history
…nal list of requirements for building a package, not listed in `pyproject.toml` and not dependencies for the package itself (#1875)

fix (tests): adopted tests
  • Loading branch information
finswimmer authored and sdispater committed Jan 20, 2020
1 parent 22f06e5 commit a0c9357
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
11 changes: 6 additions & 5 deletions poetry/masonry/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@

def get_requires_for_build_wheel(config_settings=None):
"""
Returns a list of requirements for building, as strings
"""
poetry = Factory().create_poetry(Path("."))
Returns an additional list of requirements for building, as PEP508 strings,
above and beyond those specified in the pyproject.toml file.
main, _ = SdistBuilder.convert_dependencies(poetry.package, poetry.package.requires)
This implementation is optional. At the moment it only returns an empty list, which would be the same as if
not define. So this is just for completeness for future implementation.
"""

return main
return []


# For now, we require all dependencies to build either a wheel or an sdist.
Expand Down
8 changes: 4 additions & 4 deletions tests/masonry/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ def cwd(directory):


def test_get_requires_for_build_wheel():
expected = ["cleo>=0.6.0,<0.7.0", "cachy[msgpack]>=0.2.0,<0.3.0"]
expected = []
with cwd(os.path.join(fixtures, "complete")):
api.get_requires_for_build_wheel() == expected
assert api.get_requires_for_build_wheel() == expected


def test_get_requires_for_build_sdist():
expected = ["cleo>=0.6.0,<0.7.0", "cachy[msgpack]>=0.2.0,<0.3.0"]
expected = []
with cwd(os.path.join(fixtures, "complete")):
api.get_requires_for_build_sdist() == expected
assert api.get_requires_for_build_sdist() == expected


def test_build_wheel():
Expand Down

0 comments on commit a0c9357

Please sign in to comment.