Skip to content

Commit

Permalink
Improve test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Prescod committed Nov 26, 2021
1 parent ca96441 commit 87457ad
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,30 @@ def graphviz_available():


class TestImageOuputStreams:
@mock.patch("subprocess.Popen")
def test_image_outputs_mocked(self, popen):
png = "out.png"
svg = "out.svg"
txt = "out.txt"
dot = "out.dot"
popen.return_value.communicate = lambda: (mock.Mock(), mock.Mock())
generate_cli.main(
[
str(sample_yaml),
"--output-file",
png,
"--output-file",
svg,
"--output-file",
txt,
"--output-file",
dot,
],
standalone_mode=False,
)
for call in popen.mock_calls:
assert call[1][0][0] == "dot"

def test_image_outputs(self):
if not graphviz_available():
pytest.skip("Graphviz is not installed")
Expand Down

0 comments on commit 87457ad

Please sign in to comment.