bobber6467 / python-nose

Automatically exported from code.google.com/p/python-nose
0 stars 0 forks source link

SkipTest not handled from test generators #345

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Raising SkipTest from a test generator does not skip the current test, as
expected. Instead the exception propagates up and stops all the tests.

Nose version 0.10.4

~$ cat hello.py
from nose import SkipTest
import nose.tools as NT

def test_skip_normal():
    raise SkipTest("Normal skip")

def test_skip_generator():
    yield NT.assert_true, True
    raise SkipTest("Weird skip")

~$ nosetests -v hello.py
hello.test_skip_normal ... SKIP: Normal skip
hello.test_skip_generator(True,) ... ok
Traceback (most recent call last):
  File "/home/josh/hello.py", line 9, in test_skip_generator
    raise SkipTest("Weird skip")
nose.plugins.skip.SkipTest: Weird skip

Original issue reported on code.google.com by jleedev on 22 Jun 2010 at 8:42

GoogleCodeExporter commented 8 years ago
0.10.4 is a very old version. Does 0.11.2 still have this issue?

Original comment by jpelle...@gmail.com on 22 Jun 2010 at 9:10

GoogleCodeExporter commented 8 years ago
Aha, it works in 0.11.3. It outputs 'Failure:' before the generator one, but is 
otherwise properly behaved.

hello.test_skip_normal ... SKIP: Normal skip
hello.test_skip_generator(True,) ... ok
Failure: SkipTest (Weird skip) ... SKIP: Weird skip

----------------------------------------------------------------------
Ran 3 tests in 0.024s

OK (SKIP=2)

Original comment by jleedev on 23 Jun 2010 at 2:46