Created
April 21, 2018 15:39
-
-
Save alysivji/a2535eae67a5569fa0169766c228f818 to your computer and use it in GitHub Desktop.
Answering Jeff's question from https://alysivji.github.io/pytest-fixures-with-function-arguments.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Where does mocker come from?
`
I combined all of the relevant python software into a single file:
I'm sorry it so long to get back to you. I appreciate your kind assistance.