commit 4d2335da6960979f553aab532001479d53fadcf9 Author: Isis Lovecruft isis@torproject.org Date: Fri Dec 20 03:25:22 2013 +0000
Rewrite test_Tests.OldUnittests to use DynamicTestCaseMeta. --- lib/bridgedb/test/test_Tests.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/lib/bridgedb/test/test_Tests.py b/lib/bridgedb/test/test_Tests.py index 4e383d5..d45d27a 100644 --- a/lib/bridgedb/test/test_Tests.py +++ b/lib/bridgedb/test/test_Tests.py @@ -192,10 +192,19 @@ class DynamicTestCaseMeta(type): class OldUnittests(unittest.TestCase): """A wrapper around :mod:`bridgedb.Tests` to produce :mod:`~twisted.trial` compatible output. + + Generates a :class:`twisted.trial.unittest.TestCase` containing a + test for each of the individual tests in :mod:`bridgedb.Tests`. + + Each test in this :class:`~twisted.trial.unittest.TestCase`` is + dynamically generated from one of the old unittests in + :mod:`bridgedb.Tests`. Then, the class is wrapped to cause the results + reporting mechanisms to be :mod:`~twisted.trial` compatible. + + :returns: A :class:`twisted.trial.unittest.TestCase`. """ + __metaclass__ = DynamicTestCaseMeta + testSuites = Tests.testSuite() + testResult = unittest.PyUnitResultAdapter(pyunit.TestResult()) + methodPrefix = 'test_regressionsNewCode_'
- def test_allOldUnittests(self): - testSuite = Tests.testSuite() - testResult = pyunit.TestResult() - testSuite.run(testResult, debug=True) - return unittest.PyUnitResultAdapter(testResult)
tor-commits@lists.torproject.org