[MERGE] Move skipped test detection to TestCase, and make reporting use an addSkip method as per testtools.

Vincent Ladeuil v.ladeuil+lp at free.fr
Sun Mar 1 09:27:30 GMT 2009


>>>>> "robert" == Robert Collins <robert.collins at canonical.com> writes:

    robert> This moves the detection that a test is skipping into
    robert> TestCase rather than being done after-the-fact by
    robert> TestResult.

Yeah for clearer code.

    robert> === modified file 'bzrlib/tests/__init__.py'
    robert> --- bzrlib/tests/__init__.py	2009-02-25 23:52:42 +0000
    robert> +++ bzrlib/tests/__init__.py	2009-03-01 02:57:51 +0000

    robert> @@ -1294,7 +1302,57 @@

<snip/>

    robert> +                    except self.failureException:
    robert> +                        result.addFailure(self, self._exc_info())
    robert> +                    except TestSkipped, e:
    robert> +                        if not e.args:
    robert> +                            reason = "No reason given."
    robert> +                        else:
    robert> +                            reason = e.args[0]
    robert> +                        self._do_skip(result, reason)
    robert> +                    except self.failureException:
    robert> +                        result.addFailure(self, self._exc_info())

You already said that.

<snip/>
 
    robert>      def tearDown(self):
    robert>          self._runCleanups()
    robert> +        self._log_contents = ''
    robert>          unittest.TestCase.tearDown(self)

Pff, _log_contents handling is a mess...

BB:tweak

only for the duplicated exception catching, otherwise, that's a
vibrant approve ;-)

        Vincent



More information about the bazaar mailing list