bobber6467 / python-nose

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

@attr in subclasses of unittest.TestCase misbehaves #471

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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.

Original issue reported on code.google.com by tommi.vi...@dreamhost.com on 15 Nov 2011 at 8:04