Did I find the right examples for you? yes no

All Samples(12)  |  Call(7)  |  Derive(0)  |  Import(5)
A set of monkey-patches that can be applied and removed all together.

Use this to cover up attributes with new objects. Particularly useful for
testing difficult code.

src/s/a/saucelabsfixture-0.1/saucelabsfixture/sst.py   saucelabsfixture(Download)
 
from saucelabsfixture.ondemand import SauceOnDemandFixture
from testtools.monkey import MonkeyPatcher
 
 
    def setUp(self):
        from sst import actions
        super(SSTOnDemandFixture, self).setUp()
        patcher = MonkeyPatcher(
            (actions, "browser", self.driver),

src/t/e/testtools-0.9.35/testtools/tests/test_monkey.py   testtools(Download)
from testtools import TestCase
from testtools.matchers import MatchesException, Raises
from testtools.monkey import MonkeyPatcher, patch
 
 
    def setUp(self):
        super(MonkeyPatcherTest, self).setUp()
        self.test_object = TestObj()
        self.original_object = TestObj()
        self.monkey_patcher = MonkeyPatcher()
    def test_construct_with_patches(self):
        # Constructing a 'MonkeyPatcher' with patches adds all of the given
        # patches to the patch list.
        patcher = MonkeyPatcher((self.test_object, 'foo', 'haha'),
                                (self.test_object, 'bar', 'hehe'))

src/t/e/testtools-HEAD/testtools/tests/test_monkey.py   testtools(Download)
from testtools import TestCase
from testtools.matchers import MatchesException, Raises
from testtools.monkey import MonkeyPatcher, patch
 
 
    def setUp(self):
        super(MonkeyPatcherTest, self).setUp()
        self.test_object = TestObj()
        self.original_object = TestObj()
        self.monkey_patcher = MonkeyPatcher()
    def test_construct_with_patches(self):
        # Constructing a 'MonkeyPatcher' with patches adds all of the given
        # patches to the patch list.
        patcher = MonkeyPatcher((self.test_object, 'foo', 'haha'),
                                (self.test_object, 'bar', 'hehe'))

src/t/e/testtools-HEAD/testtools/_spinner.py   testtools(Download)
import signal
 
from testtools.monkey import MonkeyPatcher
 
from twisted.internet import defer
            it's an error, then raise that.
        """
        debug = MonkeyPatcher()
        if self._debug:
            debug.add_patch(defer.Deferred, 'debug', True)

src/t/e/testtools-0.9.35/testtools/_spinner.py   testtools(Download)
import signal
 
from testtools.monkey import MonkeyPatcher
 
from twisted.internet import defer
            it's an error, then raise that.
        """
        debug = MonkeyPatcher()
        if self._debug:
            debug.add_patch(defer.Deferred, 'debug', True)