Comment 2 for bug 1529047

Revision history for this message
Jonathan Lange (jml) wrote : Re: [Bug 1529047] Re: Skipping all tests in a class is awkward

They *do* work on unittest but they don't work from testtools:

## testtools + skipping

```python
import unittest
from testtools import skipIf

@skipIf(True, 'Ha!')
class FooTests(unittest.TestCase):

    def setUp(self):
        pass

    def test_foo(self):
        print 'foo'

    def test_bar(self):
        print 'bar'

unittest.main()
```

Result: Ran 0 tests in 0.000s

## testtools + no skipping

```python
import unittest
from testtools import skipIf

@skipIf(False, 'Ha!')
class FooTests(unittest.TestCase):

    def setUp(self):
        pass

    def test_foo(self):
        print 'foo'

    def test_bar(self):
        print 'bar'

unittest.main()
```

Result:
bar
.foo
.
----------------------------------------------------------------------
Ran 2 tests in 0.000s

## unittest + skipping

```python
import unittest
from unittest import skipIf

@skipIf(True, 'Ha!')
class FooTests(unittest.TestCase):

    def setUp(self):
        pass

    def test_foo(self):
        print 'foo'

    def test_bar(self):
        print 'bar'

unittest.main()
```

Result:
ss
----------------------------------------------------------------------
Ran 2 tests in 0.000s

## unittest + no skipping

```python
import unittest
from unittest import skipIf

@skipIf(False, 'Ha!')
class FooTests(unittest.TestCase):

    def setUp(self):
        pass

    def test_foo(self):
        print 'foo'

    def test_bar(self):
        print 'bar'

unittest.main()
```

Result:

```
bar
.foo
.
----------------------------------------------------------------------
Ran 2 tests in 0.000s
```

On Thu, 24 Dec 2015 at 19:25 Robert Collins <email address hidden>
wrote:

> I thought the decorators did work on classes? They do in unittest which
> we largely derive from.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1529047
>
> Title:
> Skipping all tests in a class is awkward
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/testtools/+bug/1529047/+subscriptions
>