forked from buildbot/buildbot
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Monkeypatch startService and stopService to assert on running
This adds a new monkeypatch module which will hopefully be useful in adding more monkey patches later. It should make tracking down service-management bugs in tests *much* easier.
- Loading branch information
Dustin J. Mitchell
committed
Mar 12, 2010
1 parent
9ce34be
commit db22729
Showing
6 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Import this module and call the monkeypatch() method to add a bunch of useful | ||
# Twisted monkeypatches that help to catch stupid errors. | ||
|
||
def monkeypatch_startService(): | ||
from twisted.application.service import Service | ||
old_startService = Service.startService | ||
old_stopService = Service.stopService | ||
def startService(self): | ||
assert not self.running | ||
return old_startService(self) | ||
def stopService(self): | ||
assert self.running | ||
return old_stopService(self) | ||
Service.startService = startService | ||
Service.stopService = stopService | ||
|
||
def monkeypatch(): | ||
monkeypatch_startService() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters