Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: third_party/twisted_8_1/twisted/test/time_helpers.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/twisted_8_1/twisted/test/time_helpers.py
diff --git a/third_party/twisted_8_1/twisted/test/time_helpers.py b/third_party/twisted_8_1/twisted/test/time_helpers.py
deleted file mode 100644
index fd8aecc1aa1a3e6cf7a9d8447e193892daaf2e2c..0000000000000000000000000000000000000000
--- a/third_party/twisted_8_1/twisted/test/time_helpers.py
+++ /dev/null
@@ -1,65 +0,0 @@
-# Copyright (c) 2001-2007 Twisted Matrix Laboratories.
-# See LICENSE for details.
-
-"""
-Helper class to writing deterministic time-based unit tests.
-
-Do not use this module. It is a lie. See L{twisted.internet.task.Clock}
-instead.
-"""
-
-class Clock(object):
- """
- A utility for monkey-patches various parts of Twisted to use a
- simulated timing mechanism. DO NOT use this class. Use
- L{twisted.internet.task.Clock}.
- """
- rightNow = 0.0
-
- def __call__(self):
- """
- Return the current simulated time.
- """
- return self.rightNow
-
- def install(self):
- """
- Monkeypatch L{twisted.internet.reactor.seconds} to use
- L{__call__} as a time source
- """
- # Violation is fun.
- from twisted.internet import reactor
- self.reactor_original = reactor.seconds
- reactor.seconds = self
-
- def uninstall(self):
- """
- Remove the monkeypatching of L{twisted.internet.reactor.seconds}.
- """
- from twisted.internet import reactor
- reactor.seconds = self.reactor_original
-
- def adjust(self, amount):
- """
- Adjust the current simulated time upward by the given C{amount}.
-
- Note that this does not cause any scheduled calls to be run.
- """
- self.rightNow += amount
-
- def pump(self, reactor, timings):
- """
- Iterate the given C{reactor} with increments of time specified
- by C{timings}.
-
- For each timing, the simulated time will be L{adjust}ed and
- the reactor will be iterated twice.
- """
- timings = list(timings)
- timings.reverse()
- self.adjust(timings.pop())
- while timings:
- self.adjust(timings.pop())
- reactor.iterate()
- reactor.iterate()
-
« no previous file with comments | « third_party/twisted_8_1/twisted/test/threading_latency.py ('k') | third_party/twisted_8_1/twisted/topfiles/CREDITS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698