Skip to content

Commit

Permalink
Add a test for uncovered branch in the writer module (#1101)
Browse files Browse the repository at this point in the history
  • Loading branch information
atugushev authored Apr 10, 2020
1 parent b71ab5f commit 1c503c9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/test_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,28 @@ def test_iter_lines__hash_missing(writer, from_line):
assert tuple(lines) == expected_lines


def test_iter_lines__no_warn_if_only_unhashable_packages(writer, from_line):
"""
There shouldn't be MESSAGE_UNHASHED_PACKAGE warning if there are only unhashable
packages. See GH-1101.
"""
writer.allow_unsafe = False
writer.emit_header = False
ireqs = [
from_line("file:///unhashable-pkg1/#egg=unhashable-pkg1"),
from_line("file:///unhashable-pkg2/#egg=unhashable-pkg2"),
]
hashes = {ireq: set() for ireq in ireqs}

lines = writer._iter_lines(ireqs, hashes=hashes)

expected_lines = (
"file:///unhashable-pkg1/#egg=unhashable-pkg1",
"file:///unhashable-pkg2/#egg=unhashable-pkg2",
)
assert tuple(lines) == expected_lines


def test_write_header(writer):
expected = map(
comment,
Expand Down

0 comments on commit 1c503c9

Please sign in to comment.