aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/Twisted/py2/twisted/trial/_dist/distreporter.py
diff options
context:
space:
mode:
authorshmel1k <shmel1k@ydb.tech>2023-11-26 18:16:14 +0300
committershmel1k <shmel1k@ydb.tech>2023-11-26 18:43:30 +0300
commitb8cf9e88f4c5c64d9406af533d8948deb050d695 (patch)
tree218eb61fb3c3b96ec08b4d8cdfef383104a87d63 /contrib/python/Twisted/py2/twisted/trial/_dist/distreporter.py
parent523f645a83a0ec97a0332dbc3863bb354c92a328 (diff)
downloadydb-b8cf9e88f4c5c64d9406af533d8948deb050d695.tar.gz
add kikimr_configure
Diffstat (limited to 'contrib/python/Twisted/py2/twisted/trial/_dist/distreporter.py')
-rw-r--r--contrib/python/Twisted/py2/twisted/trial/_dist/distreporter.py93
1 files changed, 93 insertions, 0 deletions
diff --git a/contrib/python/Twisted/py2/twisted/trial/_dist/distreporter.py b/contrib/python/Twisted/py2/twisted/trial/_dist/distreporter.py
new file mode 100644
index 0000000000..6648b7a0aa
--- /dev/null
+++ b/contrib/python/Twisted/py2/twisted/trial/_dist/distreporter.py
@@ -0,0 +1,93 @@
+# -*- test-case-name: twisted.trial._dist.test.test_distreporter -*-
+#
+# Copyright (c) Twisted Matrix Laboratories.
+# See LICENSE for details.
+
+"""
+The reporter is not made to support concurrent test running, so we will
+hold test results in here and only send them to the reporter once the
+test is over.
+
+@since: 12.3
+"""
+
+from zope.interface import implementer
+from twisted.trial.itrial import IReporter
+from twisted.python.components import proxyForInterface
+
+
+
+@implementer(IReporter)
+class DistReporter(proxyForInterface(IReporter)):
+ """
+ See module docstring.
+ """
+
+ def __init__(self, original):
+ super(DistReporter, self).__init__(original)
+ self.running = {}
+
+
+ def startTest(self, test):
+ """
+ Queue test starting.
+ """
+ self.running[test.id()] = []
+ self.running[test.id()].append((self.original.startTest, test))
+
+
+ def addFailure(self, test, fail):
+ """
+ Queue adding a failure.
+ """
+ self.running[test.id()].append((self.original.addFailure,
+ test, fail))
+
+
+ def addError(self, test, error):
+ """
+ Queue error adding.
+ """
+ self.running[test.id()].append((self.original.addError,
+ test, error))
+
+
+ def addSkip(self, test, reason):
+ """
+ Queue adding a skip.
+ """
+ self.running[test.id()].append((self.original.addSkip,
+ test, reason))
+
+
+ def addUnexpectedSuccess(self, test, todo=None):
+ """
+ Queue adding an unexpected success.
+ """
+ self.running[test.id()].append((self.original.addUnexpectedSuccess,
+ test, todo))
+
+
+ def addExpectedFailure(self, test, error, todo=None):
+ """
+ Queue adding an unexpected failure.
+ """
+ self.running[test.id()].append((self.original.addExpectedFailure,
+ test, error, todo))
+
+
+ def addSuccess(self, test):
+ """
+ Queue adding a success.
+ """
+ self.running[test.id()].append((self.original.addSuccess, test))
+
+
+ def stopTest(self, test):
+ """
+ Queue stopping the test, then unroll the queue.
+ """
+ self.running[test.id()].append((self.original.stopTest, test))
+ for step in self.running[test.id()]:
+ step[0](*step[1:])
+ del self.running[test.id()]