Example #1
0
 def test_dealsWithThreeTuples(self):
     """
     Some annoying stuff can pass three-tuples to addError instead of
     Failures (like PyUnit). The wrapper, of course, handles this case,
     since it is a part of L{twisted.trial.itrial.IReporter}! But it does
     not convert L{DirtyReactorError} to warnings in this case, because
     nobody should be passing those in the form of three-tuples.
     """
     result = UncleanWarningsReporterWrapper(
         reporter.Reporter(stream=self.output))
     result.addError(self.test,
                     (self.dirtyError.type, self.dirtyError.value, None))
     self.assertEqual(len(result._originalReporter.errors), 1)
     self.assertEquals(result._originalReporter.errors[0][1].type,
                       self.dirtyError.type)
     self.assertEquals(result._originalReporter.errors[0][1].value,
                       self.dirtyError.value)
Example #2
0
 def _makeResult(self):
     reporter = self.reporterFactory(self.stream, self.tbformat,
                                     self.rterrors, self._log)
     if self._exitFirst:
         reporter = _ExitWrapper(reporter)
     if self.uncleanWarnings:
         reporter = UncleanWarningsReporterWrapper(reporter)
     return reporter
Example #3
0
 def test_dealsWithThreeTuples(self):
     """
     Some annoying stuff can pass three-tuples to addError instead of
     Failures (like PyUnit). The wrapper, of course, handles this case,
     since it is a part of L{twisted.trial.itrial.IReporter}! But it does
     not convert L{DirtyReactorError} to warnings in this case, because
     nobody should be passing those in the form of three-tuples.
     """
     result = UncleanWarningsReporterWrapper(
         reporter.Reporter(stream=self.output))
     result.addError(self.test,
                     (self.dirtyError.type, self.dirtyError.value, None))
     self.assertEqual(len(result._originalReporter.errors), 1)
     self.assertEquals(result._originalReporter.errors[0][1].type,
                       self.dirtyError.type)
     self.assertEquals(result._originalReporter.errors[0][1].value,
                       self.dirtyError.value)
Example #4
0
 def _makeResult(self):
     """
     Make reporter factory, and wrap it with a L{DistReporter}.
     """
     reporter = self._reporterFactory(self._stream,
                                      self._tbformat,
                                      realtime=self._rterrors)
     if self._uncleanWarnings:
         reporter = UncleanWarningsReporterWrapper(reporter)
     return self._distReporterFactory(reporter)
Example #5
0
 def test_warningsEnabled(self):
     """
     C{DirtyReactorErrors}s are reported as warnings when using the
     L{UncleanWarningsReporterWrapper}.
     """
     result = UncleanWarningsReporterWrapper(
         reporter.Reporter(stream=self.output))
     self.assertWarns(UserWarning, self.dirtyError.getErrorMessage(),
                      reporter.__file__, result.addError, self.test,
                      self.dirtyError)
Example #6
0
 def test_warningsMaskErrors(self):
     """
     C{DirtyReactorErrors}s are I{not} reported as errors if the
     L{UncleanWarningsReporterWrapper} is used.
     """
     result = UncleanWarningsReporterWrapper(
         reporter.Reporter(stream=self.output))
     self.assertWarns(UserWarning, self.dirtyError.getErrorMessage(),
                      reporter.__file__, result.addError, self.test,
                      self.dirtyError)
     self.assertEquals(result._originalReporter.errors, [])
Example #7
0
 def setUp(self):
     TodoTest.setUp(self)
     self.result = UncleanWarningsReporterWrapper(self.result)
Example #8
0
 def setUp(self):
     self.loader = runner.TestLoader()
     self.output = StringIO.StringIO()
     self.result = UncleanWarningsReporterWrapper(
         reporter.Reporter(self.output))
Example #9
0
 def _makeResult(self):
     reporter = self.reporterFactory(self.stream, self.tbformat,
                                     self.rterrors)
     if self.uncleanWarnings:
         reporter = UncleanWarningsReporterWrapper(reporter)
     return reporter