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

Fix git dependencies #30

Merged
merged 9 commits into from
May 10, 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
4 changes: 2 additions & 2 deletions poetry/core/packages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def dependency_from_pep_508(
name = parts[0].strip()
if len(parts) > 1:
rest = parts[1]
if ";" in rest:
name += ";" + rest.split(";", 1)[1]
if " ;" in rest:
name += " ;" + rest.split(" ;", 1)[1]
simonepri marked this conversation as resolved.
Show resolved Hide resolved

req = Requirement(name)

Expand Down
2 changes: 1 addition & 1 deletion poetry/core/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def parse_requires(requires): # type: (str) -> List[str]
continue

if current_marker:
line = "{}; {}".format(line, current_marker)
line = "{} ; {}".format(line, current_marker)

requires_dist.append(line)

Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest

from poetry.core.utils._compat import Path
from tests.utils import tempfile
from tests.testutils import tempfile


def pytest_addoption(parser):
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/test_pep517.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from pep517.check import check
from poetry.core.utils._compat import PY35
from poetry.core.utils._compat import Path
from tests.utils import subprocess_run
from tests.utils import temporary_project_directory
from tests.testutils import subprocess_run
from tests.testutils import temporary_project_directory


pytestmark = pytest.mark.integration
Expand Down
16 changes: 16 additions & 0 deletions tests/packages/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,22 @@ def test_dependency_from_pep_508_with_git_url():
assert "1.2" == dep.reference


def test_dependency_from_pep_508_with_git_url_and_comment_and_extra():
name = (
"poetry @ git+https://github.com/python-poetry/poetry.git@b;ar;#egg=poetry"
' ; extra == "foo;"'
)

dep = dependency_from_pep_508(name)

assert "poetry" == dep.name
assert dep.is_vcs()
assert "git" == dep.vcs
assert "https://github.com/python-poetry/poetry.git" == dep.source
assert "b;ar;" == dep.reference
simonepri marked this conversation as resolved.
Show resolved Hide resolved
assert dep.in_extras == ["foo;"]


def test_dependency_from_pep_508_with_url():
name = "django-utils @ https://example.com/django-utils-1.0.0.tar.gz"

Expand Down
File renamed without changes.
Empty file added tests/utils/__init__.py
Empty file.
54 changes: 54 additions & 0 deletions tests/utils/test_helpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
from poetry.core.utils.helpers import parse_requires


def test_parse_requires():
requires = """\
jsonschema>=2.6.0.0,<3.0.0.0
lockfile>=0.12.0.0,<0.13.0.0
pip-tools>=1.11.0.0,<2.0.0.0
pkginfo>=1.4.0.0,<2.0.0.0
pyrsistent>=0.14.2.0,<0.15.0.0
toml>=0.9.0.0,<0.10.0.0
cleo>=0.6.0.0,<0.7.0.0
cachy>=0.1.1.0,<0.2.0.0
cachecontrol>=0.12.4.0,<0.13.0.0
requests>=2.18.0.0,<3.0.0.0
msgpack-python>=0.5.0.0,<0.6.0.0
pyparsing>=2.2.0.0,<3.0.0.0
requests-toolbelt>=0.8.0.0,<0.9.0.0

[:(python_version >= "2.7.0.0" and python_version < "2.8.0.0") or (python_version >= "3.4.0.0" and python_version < "3.5.0.0")]
typing>=3.6.0.0,<4.0.0.0

[:python_version >= "2.7.0.0" and python_version < "2.8.0.0"]
virtualenv>=15.2.0.0,<16.0.0.0
pathlib2>=2.3.0.0,<3.0.0.0

[:python_version >= "3.4.0.0" and python_version < "3.6.0.0"]
zipfile36>=0.1.0.0,<0.2.0.0

[dev]
isort@ git+git://github.com/timothycrosley/isort.git@e63ae06ec7d70b06df9e528357650281a3d3ec22#egg=isort
"""
result = parse_requires(requires)
expected = [
"jsonschema>=2.6.0.0,<3.0.0.0",
"lockfile>=0.12.0.0,<0.13.0.0",
"pip-tools>=1.11.0.0,<2.0.0.0",
"pkginfo>=1.4.0.0,<2.0.0.0",
"pyrsistent>=0.14.2.0,<0.15.0.0",
"toml>=0.9.0.0,<0.10.0.0",
"cleo>=0.6.0.0,<0.7.0.0",
"cachy>=0.1.1.0,<0.2.0.0",
"cachecontrol>=0.12.4.0,<0.13.0.0",
"requests>=2.18.0.0,<3.0.0.0",
"msgpack-python>=0.5.0.0,<0.6.0.0",
"pyparsing>=2.2.0.0,<3.0.0.0",
"requests-toolbelt>=0.8.0.0,<0.9.0.0",
'typing>=3.6.0.0,<4.0.0.0 ; (python_version >= "2.7.0.0" and python_version < "2.8.0.0") or (python_version >= "3.4.0.0" and python_version < "3.5.0.0")',
'virtualenv>=15.2.0.0,<16.0.0.0 ; python_version >= "2.7.0.0" and python_version < "2.8.0.0"',
'pathlib2>=2.3.0.0,<3.0.0.0 ; python_version >= "2.7.0.0" and python_version < "2.8.0.0"',
'zipfile36>=0.1.0.0,<0.2.0.0 ; python_version >= "3.4.0.0" and python_version < "3.6.0.0"',
'isort@ git+git://github.com/timothycrosley/isort.git@e63ae06ec7d70b06df9e528357650281a3d3ec22#egg=isort ; extra == "dev"',
]
assert result == expected