Skip to content

Instantly share code, notes, and snippets.

@WaltHP
Created May 8, 2015 16:15
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 WaltHP/9480fcb65938d5cb8e4b to your computer and use it in GitHub Desktop.
Save WaltHP/9480fcb65938d5cb8e4b to your computer and use it in GitHub Desktop.
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