1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-14 14:48:49 +00:00

Add: mocker for subprocess.Popen.

This commit is contained in:
ik1ne 2019-10-08 18:31:16 +09:00
parent b75c40e3b1
commit 02053dfbc4

View File

@ -1,3 +1,5 @@
from io import BytesIO
import pytest
from thefuck.rules.yum_invalid_operation import match, get_new_command, _get_operations
@ -149,6 +151,14 @@ def test_not_match(command, output):
assert not match(Command(command, output))
@pytest.fixture
def yum_help(mocker):
mock = mocker.patch('subprocess.Popen')
mock.return_value.stdout = BytesIO(bytes(yum_help_text.encode('utf-8')))
return mock
@pytest.mark.usefixtures('no_memoize', 'yum_help')
def test_get_operations():
assert _get_operations() == yum_operations