diff --git a/poetry/packages/package.py b/poetry/packages/package.py index 4b39bb9eb5c..4a29318c25a 100644 --- a/poetry/packages/package.py +++ b/poetry/packages/package.py @@ -163,11 +163,10 @@ def _get_author(self): # type: () -> dict m = AUTHOR_REGEX.match(self._authors[0]) if m is None: - logger.warning( + raise ValueError( "Invalid author string. Must be in the format: " "John Smith " ) - return {"name": None, "email": None} name = m.group("name") email = m.group("email") @@ -181,11 +180,10 @@ def _get_maintainer(self): # type: () -> dict m = AUTHOR_REGEX.match(self._maintainers[0]) if m is None: - logger.warning( + raise ValueError( "Invalid maintainer string. Must be in the format: " "John Smith " ) - return {"name": None, "email": None} name = m.group("name") email = m.group("email") diff --git a/tests/packages/test_package.py b/tests/packages/test_package.py index c25e15cde48..5ac0b56efa5 100644 --- a/tests/packages/test_package.py +++ b/tests/packages/test_package.py @@ -17,9 +17,18 @@ def test_package_authors(): assert package.author_name == "John Doe" assert package.author_email is None + +def test_package_authors_invalid(): + package = Package("foo", "0.1.0") + package.authors.insert(0, "" + ) @pytest.mark.parametrize("category", ["main", "dev"])