Skip to content

Instantly share code, notes, and snippets.

@alysivji
Created April 21, 2018 15:39
Show Gist options
  • Save alysivji/a2535eae67a5569fa0169766c228f818 to your computer and use it in GitHub Desktop.
Save alysivji/a2535eae67a5569fa0169766c228f818 to your computer and use it in GitHub Desktop.
import pytest
import interface
@pytest.fixture(scope='session')
def run_command_mock(mocker):
def _create_run_command_mock(mock_return_value):
mock_run = mocker.MagicMock(name='run command mock')
mock_run.return_value = "foo"
run_command_patch = mocker.patch('interface.run_command', new=mock_run)
return run_command_patch
return _create_run_command_mock
@alysivji
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment