Skip to content

Instantly share code, notes, and snippets.

View theacodes's full-sized avatar
🎛️
Bleep bloop

Stargirl Flowers theacodes

🎛️
Bleep bloop
View GitHub Profile
@JasonGhent
JasonGhent / pi_qemu.sh
Last active March 24, 2024 14:36
OSX raspberry pi emulation via QEMU. v2 attempt @ https://gist.github.com/JasonGhent/922f38f57c8cb77b10f3
# pulled from http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/
# expanded via http://superuser.com/questions/690060/how-to-enable-network-with-a-raspberry-pi-emulated-on-qemu
# tested with 2015-02-16-raspbian-wheezy.zip on OSX Mavericks
# OSX terminal
brew install qemu
# kernel-qemu is a linux kernel compiled with ARM1176 support.
# learn more here: http://xecdesign.com/compiling-a-kernel/
curl -OL http://xecdesign.com/downloads/linux-qemu/kernel-qemu
curl -o raspbian_latest.zip -L http://downloads.raspberrypi.org/raspbian_latest
--- sandbox.py.orig 2014-09-23 13:26:01.151339089 -0700
+++ sandbox.py 2014-09-23 13:28:04.452163114 -0700
@@ -21,6 +21,7 @@
import imp
import os
import re
+import site
import sys
import traceback
import types
@slinkp
slinkp / gist:c3ec1f47d7ecfe682ad4
Last active August 10, 2023 10:11
How to use Mock Specs Properly with Classes
"""
TL/DR:
Never instantiate mock.Mock() directly.
Instead use either mock.create_autospec(YourClass) OR mock.patch('YourClass', autospec=True).
The "spec" feature of Mock is great, it helps avoid your mocked API drifting out of sync with your real API.
But there is a gotcha if you are mocking classes directly - it's easy to mock the class but you need to
ensure the spec applies to the *instance* as well.
"""