Skip to content

Commit

Permalink
Enhance unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
raimon49 committed Dec 16, 2019
1 parent da1a7e6 commit 2c4f2f0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test_piplicenses.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,5 +493,14 @@ def mocked_open(*args, **kwargs):


def test_output_file_none(monkeypatch):
mocked_stdout = MockStdStream()
mocked_stderr = MockStdStream()
import codecs
import sys
monkeypatch.setattr(sys.stdout, 'write', mocked_stdout.write)
monkeypatch.setattr(sys.stderr, 'write', mocked_stderr.write)

save_if_needs(None, 'license list')
assert True # nothing to do if file is None
# stdout and stderr are expected not to be called
assert '' == mocked_stdout.printed
assert '' == mocked_stderr.printed

0 comments on commit 2c4f2f0

Please sign in to comment.