Ticket #1518: exitfirst.2.patch

File exitfirst.2.patch, 4.3 KB (added by Julian, 4 years ago)
  • doc/core/man/trial.1

    diff --git a/doc/core/man/trial.1 b/doc/core/man/trial.1
    index 086b401..355a56d 100644
    a b the normal test output. 
    6060.SH OPTIONS
    6161.TP
    6262\fB-j\fR, \fB--jobs\fR \fInumber\fR
    63 Set the number of process workers to run. It conflicts with the debug and
    64 profile options.
     63Set the number of process workers to run. It conflicts with the debug,
     64exitfirst and profile options.
    6565.TP
    6666\fB-b\fR, \fB--debug\fR
    6767Run the tests in a debugger. If that debugger is 'pdb' (which is the default if
    option to see a list of valid reporters. 
    156156.TP
    157157\fB-x\fR, \fB--exitfirst\fR
    158158Stop the test run after the first test which does not succeed. This includes
    159 failures, errors, or unexpected successes.
     159failures, errors, or unexpected successes. Won't work with the --jobs option
     160currently.
    160161.TP
    161162\fB--spew\fR
    162163Print an insanely verbose log of everything that happens. Useful when
  • twisted/topfiles/1518.feature

    diff --git a/twisted/topfiles/1518.feature b/twisted/topfiles/1518.feature
    index 0628b66..c32d5a1 100644
    a b  
    1 trial now has --stop and --stop-failed flags which stop the test run after the first non-success or first failure respectively.
     1trial now has an --exitfirst flag which stops the test run after the first error or failure.
  • twisted/trial/reporter.py

    diff --git a/twisted/trial/reporter.py b/twisted/trial/reporter.py
    index c57cb86..e6d8365 100644
    a b class _ExitWrapper(TestResultDecorator): 
    242242    """
    243243
    244244    def addError(self, *args, **kwargs):
    245         """
    246         See L{itrial.IReporter}.
    247         """
    248245        self.shouldStop = True
    249246        return self._originalReporter.addError(*args, **kwargs)
    250247
    251248
    252249    def addFailure(self, *args, **kwargs):
    253         """
    254         See L{itrial.IReporter}.
    255         """
    256250        self.shouldStop = True
    257251        return self._originalReporter.addFailure(*args, **kwargs)
    258252
    259253
    260     def addUnexpectedSuccess(self, *args, **kwargs):
    261         """
    262         See L{itrial.IReporter}.
    263         """
    264         self.shouldStop = True
    265         return self._originalReporter.addUnexpectedSuccess(*args, **kwargs)
    266 
    267 
    268254
    269255class _AdaptedReporter(TestResultDecorator):
    270256    """
  • twisted/trial/test/test_reporter.py

    diff --git a/twisted/trial/test/test_reporter.py b/twisted/trial/test/test_reporter.py
    index cc0fa06..0d1958c 100644
    a b class ExitWrapperTests(unittest.SynchronousTestCase): 
    16951695        L{reporter._ExitWrapper} causes a wrapped reporter to stop after its
    16961696        first failure.
    16971697        """
    1698 
    16991698        self.wrapped.addFailure(self.test, self.failure)
    17001699        self.assertTrue(self.wrapped.shouldStop)
    17011700        self.assertEqual(self.result.failures, [(self.test, self.failure)])
    class ExitWrapperTests(unittest.SynchronousTestCase): 
    17061705        L{reporter._ExitWrapper} causes a wrapped reporter to stop after its
    17071706        first error.
    17081707        """
    1709 
    17101708        self.wrapped.addError(self.test, self.failure)
    17111709        self.assertTrue(self.wrapped.shouldStop)
    17121710        self.assertEqual(self.result.errors, [(self.test, self.failure)])
    17131711
    17141712
    1715     def test_stopOnUnexpectedSuccess(self):
     1713    def test_doesNotStopOnUnexpectedSuccess(self):
    17161714        """
    1717         L{reporter._StopWrapper} causes a wrapped reporter to stop after an
    1718         unexpected success if C{onlyAfterFailure} is C{False}.
     1715        L{reporter._ExitWrapper} does not cause a wrapped reporter to stop
     1716        after an unexpected success.
    17191717        """
    1720 
    17211718        self.wrapped.addUnexpectedSuccess(self.test, self.failure)
    1722         self.assertTrue(self.wrapped.shouldStop)
     1719        self.assertFalse(self.wrapped.shouldStop)
    17231720        self.assertEqual(
    17241721            self.result.unexpectedSuccesses, [(self.test, self.failure)])
  • twisted/trial/test/test_runner.py

    diff --git a/twisted/trial/test/test_runner.py b/twisted/trial/test/test_runner.py
    index 985e7b1..e30743c 100644
    a b class TestRunner(unittest.SynchronousTestCase): 
    567567        If trial was passed the C{--exitfirst} option, the constructed test
    568568        result object is wrapped with L{reporter._ExitWrapper}.
    569569        """
    570 
    571570        self.parseOptions(["--exitfirst"])
    572571        runner = self.getRunner()
    573572        result = runner._makeResult()