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

Whitespace missing after URL in PEP508 string for URL Dependency #60

Merged
merged 1 commit into from
Aug 13, 2020
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
2 changes: 1 addition & 1 deletion poetry/core/packages/dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def to_pep_508(self, with_extras=True): # type: (bool) -> str
)

if markers:
if self.is_vcs():
if self.is_vcs() or self.is_url():
requirement += " "

if len(markers) > 1:
Expand Down
23 changes: 23 additions & 0 deletions tests/packages/test_url_dependency.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from poetry.core.packages import URLDependency
from poetry.core.version.markers import SingleMarker


def test_to_pep_508():
dependency = URLDependency(
"pytorch",
"https://download.pytorch.org/whl/cpu/torch-1.5.1%2Bcpu-cp38-cp38-linux_x86_64.whl",
)

expected = "pytorch @ https://download.pytorch.org/whl/cpu/torch-1.5.1%2Bcpu-cp38-cp38-linux_x86_64.whl"
assert expected == dependency.to_pep_508()


def test_to_pep_508_with_marker():
dependency = URLDependency(
"pytorch",
"https://download.pytorch.org/whl/cpu/torch-1.5.1%2Bcpu-cp38-cp38-linux_x86_64.whl",
)
dependency.marker = SingleMarker("sys.platform", "linux")

expected = 'pytorch @ https://download.pytorch.org/whl/cpu/torch-1.5.1%2Bcpu-cp38-cp38-linux_x86_64.whl ; sys_platform == "linux"'
assert expected == dependency.to_pep_508()