Skip to content

Instantly share code, notes, and snippets.

@blaix
Created November 26, 2012 22:12
Show Gist options
  • Save blaix/4150999 to your computer and use it in GitHub Desktop.
Save blaix/4150999 to your computer and use it in GitHub Desktop.
Patching an entire test class in python
from unittest import TestCase
from mock import patch
from my.module import MyClass
@patch("my.module.OtherClass")
class TestMyClass(TestCase):
def test_something(self, mocked_other_class):
assert "Justin is awesome"
def test_something_else(self, mocked_other_class):
assert "So is Dan"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment