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

Unified Diff: Tools/Scripts/webkitpy/thirdparty/unittest2/signals.py

Issue 478553002: Remove thirdparty/unittest2 from webkitpy and require python2.7. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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: Tools/Scripts/webkitpy/thirdparty/unittest2/signals.py
diff --git a/Tools/Scripts/webkitpy/thirdparty/unittest2/signals.py b/Tools/Scripts/webkitpy/thirdparty/unittest2/signals.py
deleted file mode 100644
index bde8f60ec951ae8f6074404c9c2ea29b80add25e..0000000000000000000000000000000000000000
--- a/Tools/Scripts/webkitpy/thirdparty/unittest2/signals.py
+++ /dev/null
@@ -1,57 +0,0 @@
-import signal
-import weakref
-
-from unittest2.compatibility import wraps
-
-__unittest = True
-
-
-class _InterruptHandler(object):
- def __init__(self, default_handler):
- self.called = False
- self.default_handler = default_handler
-
- def __call__(self, signum, frame):
- installed_handler = signal.getsignal(signal.SIGINT)
- if installed_handler is not self:
- # if we aren't the installed handler, then delegate immediately
- # to the default handler
- self.default_handler(signum, frame)
-
- if self.called:
- self.default_handler(signum, frame)
- self.called = True
- for result in _results.keys():
- result.stop()
-
-_results = weakref.WeakKeyDictionary()
-def registerResult(result):
- _results[result] = 1
-
-def removeResult(result):
- return bool(_results.pop(result, None))
-
-_interrupt_handler = None
-def installHandler():
- global _interrupt_handler
- if _interrupt_handler is None:
- default_handler = signal.getsignal(signal.SIGINT)
- _interrupt_handler = _InterruptHandler(default_handler)
- signal.signal(signal.SIGINT, _interrupt_handler)
-
-
-def removeHandler(method=None):
- if method is not None:
- @wraps(method)
- def inner(*args, **kwargs):
- initial = signal.getsignal(signal.SIGINT)
- removeHandler()
- try:
- return method(*args, **kwargs)
- finally:
- signal.signal(signal.SIGINT, initial)
- return inner
-
- global _interrupt_handler
- if _interrupt_handler is not None:
- signal.signal(signal.SIGINT, _interrupt_handler.default_handler)
« no previous file with comments | « Tools/Scripts/webkitpy/thirdparty/unittest2/runner.py ('k') | Tools/Scripts/webkitpy/thirdparty/unittest2/suite.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698