Skip to content

Instantly share code, notes, and snippets.

@escapewindow
Created July 29, 2019 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save escapewindow/d6c33e7ab87634b5bf33135056e5748d to your computer and use it in GitHub Desktop.
Save escapewindow/d6c33e7ab87634b5bf33135056e5748d to your computer and use it in GitHub Desktop.
def test_foo(mocker):
"""Example test to change params per call to `bar`"""
params = [1, 2]
def fake_bar():
param = params.pop(0)
# use param
mocker.patch.object(module, "bar", new=fake_bar)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment