Skip to content

Instantly share code, notes, and snippets.

@WaltHP

WaltHP/test.py

Created May 8, 2015
Embed
What would you like to do?
import platform
import mock
def test(arch=platform.machine()):
print "arch = %s" % arch
print "machine = %s" % platform.machine()
with mock.patch.object(platform, "machine", return_value="TEST"):
test()
# This outputs
# arch = x86_64
# machine = TEST
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment