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

Port over bugfixes from poetry 1.0.x branch #49

Merged
merged 2 commits into from
Jul 22, 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
12 changes: 12 additions & 0 deletions poetry/core/packages/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ def _get_author(self): # type: () -> dict

m = AUTHOR_REGEX.match(self._authors[0])

if m is None:
raise ValueError(
"Invalid author string. Must be in the format: "
"John Smith <john@example.com>"
)

name = m.group("name")
email = m.group("email")

Expand All @@ -183,6 +189,12 @@ def _get_maintainer(self): # type: () -> dict

m = AUTHOR_REGEX.match(self._maintainers[0])

if m is None:
raise ValueError(
"Invalid maintainer string. Must be in the format: "
"John Smith <john@example.com>"
)

name = m.group("name")
email = m.group("email")

Expand Down
2 changes: 1 addition & 1 deletion poetry/core/vcs/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def config(self): # type: () -> GitConfig
return self._config

def clone(self, repository, dest): # type: (...) -> str
return self.run("clone", repository, str(dest))
return self.run("clone", "--recurse-submodules", repository, str(dest))

def checkout(self, rev, folder=None): # type: (...) -> str
args = []
Expand Down
13 changes: 13 additions & 0 deletions tests/packages/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ def test_package_authors():
assert package.author_email is None


def test_package_authors_invalid():
package = Package("foo", "0.1.0")

package.authors.insert(0, "<John Doe")
with pytest.raises(ValueError) as e:
package.author_name

assert (
str(e.value)
== "Invalid author string. Must be in the format: John Smith <john@example.com>"
)


@pytest.mark.parametrize("category", ["main", "dev"])
def test_package_add_dependency_vcs_category(category):
package = Package("foo", "0.1.0")
Expand Down