MCPcopy Create free account
hub / github.com/twisted/twisted / patch

Method patch

src/twisted/python/monkey.py:41–49  ·  view source on GitHub ↗

Apply all of the patches that have been specified with L{addPatch}. Reverse this operation using L{restore}.

(self)

Source from the content-addressed store, hash-verified

39 return False
40
41 def patch(self):
42 """
43 Apply all of the patches that have been specified with L{addPatch}.
44 Reverse this operation using L{restore}.
45 """
46 for obj, name, value in self._patchesToApply:
47 if not self._alreadyPatched(obj, name):
48 self._originals.append((obj, name, getattr(obj, name)))
49 setattr(obj, name, value)
50
51 __enter__ = patch
52

Callers 15

runWithPatchesMethod · 0.95
patchMethod · 0.95
setUpMethod · 0.45
setUpMethod · 0.45
setUpMethod · 0.45
setUpMethod · 0.45
test_failedInitMethod · 0.45
test_failedAddWatchMethod · 0.45
test_defaultEnvironMethod · 0.45

Calls 2

_alreadyPatchedMethod · 0.95
appendMethod · 0.45

Tested by 15

patchMethod · 0.76
setUpMethod · 0.36
setUpMethod · 0.36
setUpMethod · 0.36
setUpMethod · 0.36
test_failedInitMethod · 0.36
test_failedAddWatchMethod · 0.36
test_defaultEnvironMethod · 0.36
test_mainMethod · 0.36