Created
March 8, 2017 12:16
-
-
Save obestwalter/2bae7adb5325984f801fc334ff1b8151 to your computer and use it in GitHub Desktop.
Simple DIY plumbum local mock
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
from plumbum.machines import LocalMachine | |
def get_item_mock(*_, **__): | |
def i_am_the_mocked_function(): | |
print("I am mocked") | |
return "mock value" | |
return i_am_the_mocked_function | |
LocalMachine.__getitem__ = get_item_mock | |
def test_something_with_mocked_local(): | |
from plumbum import local | |
assert local["dontcare"]() == "mock value" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment