kiwi-el8/test/unit/help_test.py
Marcus Schäfer f8bc05fd42
Refactor use of raises in unit tests
Use raises as context manager instead of a method decorator.
This clearly identifies which code part is expected to raise
an exception. Related to Issue #1128
2019-09-29 19:42:43 +02:00

21 lines
477 B
Python

from mock import patch
from pytest import raises
from kiwi.help import Help
from kiwi.exceptions import KiwiHelpNoCommandGiven
class TestHelp:
def setup(self):
self.help = Help()
def test_show(self):
with raises(KiwiHelpNoCommandGiven):
self.help.show(None)
@patch('subprocess.call')
def test_show_command(self, mock_process):
self.help.show('foo')
mock_process.assert_called_once_with('man 8 foo', shell=True)