A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-April/099037.html below:

[Python-Dev] skip all TestCase methods if resource is not available

[Python-Dev] skip all TestCase methods if resource is not available [Python-Dev] skip all TestCase methods if resource is not availableFlorent Xicluna florent.xicluna at gmail.com
Thu Apr 1 21:03:09 CEST 2010
2010/4/1 anatoly techtonik:
> On Thu, Apr 1, 2010 at 8:02 PM, Florent Xicluna wrote:
(...)
>>
>> Put it in unittest.TestCase.setUp() method. It should be enough.
>
> It fails with error instead if skip, as it should according to
> http://docs.python.org/library/unittest.html#unittest.TestCase.setUp
>
> "...any exception raised by this method will be considered an error
> rather than a test failure..."
> --
> anatoly t.
>

There's a special case for the "SkipTest" exception in 2.7 (even if it
is not documented).

            try:
                self.setUp()
            except SkipTest as e:
                self._addSkip(result, str(e))
            except Exception:
                result.addError(self, sys.exc_info())

But for 2.6, you're right:

            try:
                self.setUp()
            except:
                result.addError(self, self._exc_info())

-- 
Florent
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4