nose-devs/nose — Issue #464: @attr in subclasses of unittest.TestCase misbehaves
Author: jpellerin
Created: 2011-12-14 16:12:06+00:00
State: open

What steps will reproduce the problem?

With this in demo.py:

import unittest
from nose.plugins.attrib import attr

class OneTest(unittest.TestCase):
def test_foo(self):
print 'ONE'

class TwoTest(OneTest):
@attr('bork')
def test_foo(self):
print 'TWO'

class TestThree(object):
def test_foo(self):
print 'THREE'

class TestFour(TestThree):
@attr('bork')
def test_foo(self):
print 'FOUR'

Run

1. nosetests demo -v -s -a 'bork'
2. nosetests demo -v -s -a '!bork'

What is the expected output? What do you see instead?

Expected case 1 to output "TWO" and "FOUR".
Expected case 2 to output "ONE" and "THREE".

Saw case 1 output "FOUR" and "TWO".
Saw case 2 output "ONE", "THREE", "TWO".

-a '!bork' should have filtered out TwoTest.test_foo.

What version of the product are you using? On what operating system?

nosetests version 1.1.2 on Ubuntu 10.10 inside a virtualenv --no-site-packages.

Google Code Info:
Issue #: 471
Author: tommi.vi...@dreamhost.com
Created On: 2011-11-15T20:04:43.000Z
Closed On: