Commit 6140a803 by yamagen0915

Fix error on invalid author

parent 380e09b9
...@@ -162,6 +162,9 @@ class Package(object): ...@@ -162,6 +162,9 @@ class Package(object):
m = AUTHOR_REGEX.match(self._authors[0]) m = AUTHOR_REGEX.match(self._authors[0])
if m is None:
return {"name": None, "email": None}
name = m.group("name") name = m.group("name")
email = m.group("email") email = m.group("email")
...@@ -173,6 +176,9 @@ class Package(object): ...@@ -173,6 +176,9 @@ class Package(object):
m = AUTHOR_REGEX.match(self._maintainers[0]) m = AUTHOR_REGEX.match(self._maintainers[0])
if m is None:
return {"name": None, "email": None}
name = m.group("name") name = m.group("name")
email = m.group("email") email = m.group("email")
......
...@@ -17,6 +17,10 @@ def test_package_authors(): ...@@ -17,6 +17,10 @@ def test_package_authors():
assert package.author_name == "John Doe" assert package.author_name == "John Doe"
assert package.author_email is None assert package.author_email is None
package.authors.insert(0, "<John Doe")
assert package.author_name is None
assert package.author_email is None
@pytest.mark.parametrize("category", ["main", "dev"]) @pytest.mark.parametrize("category", ["main", "dev"])
def test_package_add_dependency_vcs_category(category): def test_package_add_dependency_vcs_category(category):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment