Skip to content

Commit

Permalink
fix: Fix crash when exported requirements contain Poetry warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cjolowicz committed Jun 11, 2021
1 parent e7295ce commit d6101a0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/nox_poetry/poetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
from enum import Enum
from pathlib import Path
from typing import Any
from typing import Iterable
from typing import Iterator
from typing import List
from typing import Optional

Expand Down Expand Up @@ -94,7 +96,15 @@ def export(self) -> str:
)

assert isinstance(output, str) # noqa: S101
return output

def _stripwarnings(lines: Iterable[str]) -> Iterator[str]:
for line in lines:
if line.startswith("Warning:"):
self.session.log(line)
continue
yield line

return "\n".join(_stripwarnings(output.splitlines()))

def build(self, *, format: str) -> str:
"""Build the package.
Expand Down

0 comments on commit d6101a0

Please sign in to comment.